Using regular expression for identifying #tags
Like How are you #friends #today is #great day.
Condition should be
# should be starting of word.
it contains letters,digits and - .
-should not appear just after the #.
after and before - there should be character or digit.
A string can contain multiple tags.
How to write regular expression for itentifying above #tags.
I tried this #{1}[A-Za-z0-9]+-*[A-Za-z0-9]+
You can use this regex:
#[A-Za-z0-9]+(-[A-Za-z0-9]+)*\b
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