I tried to search this question first but didn't found what I need, here is it:
I have a string like: "substring1/substring2.substring3" (e.g. "library/History.read")
I need a regular expression to check:
I'm not familiar with regular expression, the current I wrote is:
'library/([a-zA-Z])\\.(read)' but it is not correct. Please help me, thanks!
There are many ways to solve regex problems, starting from your own attempt here's something that works! :-)
library/([A-Z][a-zA-Z]+)\.(read)
You had three small mistakes:
. is a character class matching any character except newline. Escape your . like this \. not like this \\.; and+ qunatifier to match one or more.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With