I have the following regex
(?<=[\/]).*(?=[\/])
I'm trying to run on FM7-4/E27/U20
and I'm trying to only get the character between the two slashes, no numbers. I tried adding [^0-9]
but wasn't able to get a match. Any help would be appreciated.
CodePudding user response:
You can use
(?<=\/)[^\/\d]*(?=\d*\/)
See the regex demo.
Details:
(?<=\/)
- the/
char must appear immediately on the left[^\/\d]*
- zero or more chars other than/
and digits(?=\d*\/)
- a positive lookahead that requires zero or more digits and then/
immediately on the right.