Wednesday, April 18, 2012

Useful regular expression: how to verify perforce branch path

Here is the regular expression (aka regexp) pattern to verify if the input string matches the rules of perforce branch specification (the string should look like this: //depot/level1/level2/level3/... )
//(?:\w+?/)+?(?:\.\.\.$)
 Symbols ?:  mean that we would not like to capture them (does not make sense for match function of regular expression but still reasonable to make the logic of the pattern clear)/ 

No comments:

Post a Comment