Jump to content

[SOLVED] Basic regex expression. cant figure it out


mikesta707

Recommended Posts

Alright, so im trying to make 3 regex expressions. If i can figure out how to make this specific one work, than I can probably figure out the others. it has to match a line that looks like this

Warrior john 100

every line must start with warrior, has to have a name composed of only alphabet characters, and a number. Note that the spacing must be exactly like shown, it cant have 2 or more spaces between each element. I currently have

 

std::tr1::regex rgx1("^(Warrior) [a-zA-z]) [a-zA-z]) [0-9]{1,3}$)", std::tr1::regex_constants::icase);//warrior pattern

this is in C++ i know, but it uses PCRE regex expressions so i expect that it will be similar if not that same. I always had a hard time with regex, so I just can't figure it out, but i expect its a pretty simple regex pattern. thanks in advance

 

btw the

std::tr1::regex_constants::icase

part just makes the pattern case insensitive

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.