24

What regular expression can I use to find this?

&v=15151651616

Where &v= is a static string and the number part may vary.

Ricardo Altamirano
  • 14,650
  • 21
  • 72
  • 105
Miguel Antunes
  • 360
  • 1
  • 3
  • 8

3 Answers3

30

"^&v=[0-9]+$" if you want at least 1 number or "^&v=[0-9]*$" if no number must match too.

If you want it to match inside another sequence just remove the ^ and $, which means the sequence beginning by (^) and sequence ending with ($)

rakhi4110
  • 9,253
  • 2
  • 30
  • 49
Maresh
  • 4,644
  • 25
  • 30
28

You can use the following regular expression:

&v=\d+

This matches &v= and then one or more digits.

Timothée Boucher
  • 1,535
  • 12
  • 30
Simeon Visser
  • 118,920
  • 18
  • 185
  • 180
1

I tried the other solutions but those were not working for me but the following worked.

NAME(column):
    dbbdb
    abcdef=1244
    abc =123sfdafs
    abc= 1223 adsfa
    abc = 1323def
    abcasdafs =adfd 1323def

To find 'bc' followed by a number, Code:
. -> match any character
? -> optional (show even if there are no characters)
+ -> in addition to the search keyword

where regexp_like (NAME, 'bc.?+[0-9]');
Output:
abcdef=1244
abc =123sfdafs
abc= 1223 adsfa
abc = 1323def
abcasdafs =adfd 1323def

To find 'bc' followed by '=' and a number, no matter the spaces, Code:

where regexp_like (NAME, 'bc ?+[=] ?+[0-9]');
Output:
abc =123sfdafs
abc= 1223 adsfa
abc = 1323def
Chakraborty
  • 123
  • 1
  • 2
  • 8