0

I wish to match

&v=

and before

">

is there a regex match i could use

Example:

<a accesskey="1" href="/watch?gl=GB&amp;client=mv-google&amp;hl=en-GB&amp;v=ubNF9QNEQLA">Test Your Awareness : Whodunnit?</a>

i only need the ubNF9QNEQLA

Thanks

user393273
  • 1,430
  • 5
  • 25
  • 48
  • 1
    You want to *split* or to *match*? Splitting suggests you want to break the string into pieces based on some delimiter, but you gave two. Or do you just want to get the content that's between those two tokens? – VoteyDisciple Oct 17 '10 at 14:42
  • Since there is no built-in full regex engine in Objective C (for reference: http://stackoverflow.com/questions/422138/regular-expressions-in-an-objective-c-cocoa-application), could you kindly indicate which library/function you're using to do the match with? The answers thus far have presumed PCREs, but I am guessing you're using the built-in POSIX regexes which are significantly less powerful. – Conspicuous Compiler Oct 17 '10 at 15:36
  • RegexKitLite is what i am using – user393273 Oct 17 '10 at 17:15

3 Answers3

1
/&amp;v=([^(">)]+)/
Alan Haggai Alavi
  • 72,802
  • 19
  • 102
  • 127
0
 /&v=(.*?)">/

The question mark tells the wild char matching to be lazy so it will stop at the first "> rather than at the last one.

Motti
  • 110,860
  • 49
  • 189
  • 262
0
/&amp;v=(.*)>/

This solved it

user393273
  • 1,430
  • 5
  • 25
  • 48