Help needed in writing regular expression -- TCL

Posted by user330727 on Stack Overflow See other posts from Stack Overflow or by user330727
Published on 2010-05-02T09:01:39Z Indexed on 2010/05/02 9:17 UTC
Read the original article Hit count: 166

Filed under:

Hello Everyone,

Just seeking a favour to write a regular expression to match the following set of strings. I want to write an expression which matches all the following strings TCL

i) ( XYZ XZZ XVZ XWZ )

Clue : Starting string is X and Z ending string is same for all the pairs. Only the middle string is differs Y Z V W.

My trial: [regexp {^X([Y|Z|V|W]*)Z$}]

I want to write an another regexp which catches/matches only the following string wherever comes

ii) (XYZ)

My trial: [regexp {^X([Y]*)Z$}]

© Stack Overflow or respective owner

Related posts about tcl