Hi, anyone knows if there is a way to convert an input string into a Regular Expression??
As a example, if I input the string: "email@mail.com" the output string should be like: "[A-Za-z]+@[A-Za-z]+\\.com"
Thanks in advance!!
Printable View
Hi, anyone knows if there is a way to convert an input string into a Regular Expression??
As a example, if I input the string: "email@mail.com" the output string should be like: "[A-Za-z]+@[A-Za-z]+\\.com"
Thanks in advance!!
In the most general sense, I would think that this problem is impossible. There are a lot of different regular expressions that match "email@mail.com":
"[A-Za-z]+@[A-Za-z]+\\.com"
"email@mail\\.com"
"*.@mail\\.com"
...
So, you are probably going to need more information than just a single String, but even with multiple strings, what if you get two strings, I still don't think you have enough information.