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
  • 161,384
  • 21
  • 275
  • 467
Kermia
  • 4,171
  • 13
  • 64
  • 105

4 Answers4

4

You can use the following:

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

SomeString will be captured in group 1.

ctn
  • 2,887
  • 13
  • 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,743
  • 1
  • 11
  • 27