A191919
A191919

Reputation: 3462

Regex exclude number

I have regex pattern (\s\w+(\W\w+|)\s)|(\s\w+\s) it parse sequence that contain (string,mfo,system.int32,0,...). How to rewrite pattern in such way that (0) will be excluded?

account :type string :init "" :display "account"
mfo :type string :init "" :display "mfo"
name :type string :init "" :display "name"
city :type string :init "" :display "city"
tag :type system.int32 :init 0 :display ""
domain :type string :init "" :display "domain"
name :type string :init "" :display "name"
multiplier :type system.int32 :init 0

Upvotes: 1

Views: 87

Answers (1)

Jan
Jan

Reputation: 43199

The following expression will filter your lines on type string or system.int32, the first group $1 holds the values at the end of the line:

type
\ 
(?:string|system\.int32)
.+?"?([^"]*)"?$

See a demo on regex101.com. Is this what you were after?

Upvotes: 2

Related Questions