I can have one of the following sample strings:
I need to find the words contained by the string that start with '$' where lenght except '$' is between 2 and 5 and do not contains only digits and it can contains dots , without punctuation at end.
Inside the list above, number 2,4 and 5 match my criteria.
I tried to write a regex to do that without useful result.
(?<![a-z0-9])[$]{1}[A-Z0-9\.]{2,5}(?![a-z0-9])
I use Java to match regex
Is there a regex to do that?
(?<![a-zA-Z0-9])\$(?=\S*[a-zA-Z])[a-zA-Z0-9.]{2,4}(?=\s|$)
Try this.See demo.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.