I need some help using regex in java.
Im trying to achieve 2 different validations and i dont really know how (all i know is that there’s a matches method you might use):
1) Making sure a string DOESNT include one of very specific characters lets say (char1, char2..)
And (in seperated validation – not same regex pattern as 1):
2) Making sure a string DOES include a pattern of “anythingCanBeHere@anythingCanBeHere” note that “” (empty string) and “anythingCanBeHere@” is valid BUT “@anythingCanBeHere” isn’t valid. btw, can i somehow use this regex to split in a correct way of the first value before @ and second value which is after @?
Much thanks guys, waiting for ur answer 🙂
You can validate your input like this:
Replace
blahere with the specific characters you don’t want to be included.