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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.