0

This is my string: href="/store/apps/details?id=SomeString&.

How can I extract the SomeString with PerlRegEx? I'm using Delphi XE2.

Rob Kennedy
  • 159,194
  • 20
  • 270
  • 458
Kermia
  • 4,081
  • 12
  • 59
  • 105

4 Answers4

4

You can use the following:

href="/store/apps/details\?id=([^&"]*)

SomeString will be captured in group 1.

ctn
  • 2,837
  • 11
  • 23
2

use the regex: \bid=.*(&)?

Rayhan.iit.du
  • 279
  • 1
  • 4
1

You can use the following regex

[?&]id=([^a]*)&?

http://rubular.com/r/6ivQNNBLxP

mind you depending on what is and is not an allowable input, just about any conceivable reg-ex can be tricked

1

You can use : .*id=\([^&]*\)&

Depending on the language you are using, you might find tools cleaner than regexps to perform this task.

SylvainD
  • 1,673
  • 1
  • 11
  • 25