Regular expression one or more times JAVA

Posted by user1381564 on Stack Overflow See other posts from Stack Overflow or by user1381564
Published on 2012-10-25T10:52:52Z Indexed on 2012/10/25 11:00 UTC
Read the original article Hit count: 127

Filed under:
|
|
|
|

Hi i am trying to match a string against a pattern

this is the possible string

signal CS, NS, dl: stateType := writeOrRead0; 
signal CS, pS : stateType := writeOrRead0; 
signal dS : stateType := writeOrRead0; 

i am only concerned with the pattern as far as the first colon.

but the number of signals define can be more than one it could be three or four even this is the regular expression i have

^signal\\s*(\\w+),*\\s*(\\w+)\\s*:

it will pick up the second two signal but and for the second one it picks up CS and pS and but the d and S in the next signal when i use

matcher.group()

come up seperately

Can anyone give me an expression that will pick up all signal names whether there is one two three or more?

© Stack Overflow or respective owner

Related posts about java

Related posts about regex