RegEx to match a pattern and exclude a part of the string

Posted by rojanu on Stack Overflow See other posts from Stack Overflow or by rojanu
Published on 2010-06-17T11:18:45Z Indexed on 2010/06/17 11:23 UTC
Read the original article Hit count: 261

Filed under:
|
|

Hi,

I have got some strings to be matched via RegEx. We have a java application which reads the regex from a config file and takes two groups of strings, number of which are specified in the same config.

E.g.

CustomAction.523274ca945f.dialogLabel=Executing Custom Code...

will be matched with

(?m)^(?!#)\s*(\S*)\s*=\s*(\S*.*)

What I need is to pick the first group "CustomAction.523274ca945f.dialogLabel" and exclude the random string in the middle so I end up with something like "CustomAction.dialogLabel" or "CustomAction..dialogLabel" well any other combination but the random string.

Thanks

© Stack Overflow or respective owner

Related posts about java

Related posts about regex