Reputation: 4008
I have the following regex:
(?P<value>[0-9]+)(\s*)(?P<unit>[^\d+? ])
and the string:
432 gfd-gfd gfg fd 4445 kk/ t%
For the base
is only taking the first letter: g, k.
What I want is to extract:
gfd-gfd, gfg, fd, kk/, t%
Upvotes: 0
Views: 145
Reputation: 896
The following regex will match any group of characters that does not contain a space or a digit:
[^\d\s]+
[^ // don't match any characters in this group
\d // any digit
\s // any whitespace
]+ // match one or more characters that meet these criteria
This matches all of the strings you wanted in your test case.
Upvotes: 1