Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RegExp {1} just ONE match

Status
Not open for further replies.

adelante

Programmer
Joined
May 26, 2005
Messages
82
Location
DK
RegExp:

1. U1234
2. u12345
3. UuUuu1234
4. U123rGyA424

I want to make a thing that only matches number 1 and 2 kinds of strings, and keep 3, 4 and any other strings out. Here is my best try what am I doing wrong??

if ($string =~ /u{1}\d+(?![^.])/i) {
print "It's working!";
}

So, ONE 'u' or 'U' and then a number of any length - and only that.

The u{1} doesn't seem to be working for me.

Thanks :)
 
Wow, so simple...

Thanks alot!!! :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top