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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

regexp question

Status
Not open for further replies.

Naug

Technical User
Sep 24, 2004
85
RU
Hello ppl I am trying to parse an rtf file to get clean text out but as I am new to regexp I came apon something I dont know how to do.

K, thing is I need to get a chunk of string which sattisfies following condition: indefinetely long repetition of

backslash,word symbol*

so something like (\\\w*)* where (\\\w*) would be a combination that is repeated one or more times only I dont know what the () should be.
 
Remember, a * means zero or more, a + means one or more, so (\\\w*)* would match all of the following:
''
'\'
'\word'
'\a\a\a\a\aaaaa\aaa\a\a\\\'

If you want to match just a single \ and a single \w repeatedly, use (\\\w)+ or (\\\w)* depending.

But really, unless this is academic, there's a slew of RTF modules on cpan that have been tested and thought out a great deal already.

________________________________________
Andrew

I work for a gift card company!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top