Page 1 of 1

parsing 4 dig lon int from a string of any format

Posted: Wed May 16, 2007 3:38 am
by mr00047
Hello

i want to return a 4 digit long integer number if found in a string in anyformat. i need to
search the string for 4 cosecutive number if found then return the number, if not found
4 consecutive number then it will return false;

can any one write the regular expression for me?

please help!

Posted: Wed May 16, 2007 3:59 am
by Jenk

Code: Select all

^.*\d{4}.*$

Posted: Wed May 16, 2007 5:34 am
by stereofrog
Given the string "1234 xx 567890 yy 4321", what exactly should the regexp find?