Hi
Is there any simple way or online website that can convert The numerical string like"123-322-14365" to regular expression?
tony75
10
Newbie Poster
Recommended Answers
Jump to PostA regular expression defines the rules by which a string can be analysed as conforming or not conforming to those rules. A numeric sample string does not define what the rules should be, it's just one example - eg we know that "123-322-14365" is valid, but what about "12-322-14365" etc …
Jump to PostIt is not right answer - redundant white space after hiphens
right is:(\d{3}[-]){2}\d{5}
(three digits with followed hiphens) {two times} and then five digits
Jump to PostIt's a really bad question. "123-422-17365" is just one string. A valid answer would be
"123-422-17365" - thats a regex that matches the string.
If you want to ask about a regex then at the very least you need a few examples of valid and invalid strings.
All 10 Replies
Reverend Jim
4,678
Hi, I'm Jim, one of DaniWeb's moderators.
Moderator
Featured Poster
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
Reverend Jim
commented:
Well sure, if you want to use words.
+15
pty
882
Posting Pro
Reverend Jim
commented:
Hah
+15
tony75
10
Newbie Poster
AndrisP
193
Posting Pro in Training
rproffitt
2,565
"Nothing to see here."
Moderator
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
rproffitt
commented:
Yup, that works too.
+15
Reverend Jim
4,678
Hi, I'm Jim, one of DaniWeb's moderators.
Moderator
Featured Poster
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
Reverend Jim
4,678
Hi, I'm Jim, one of DaniWeb's moderators.
Moderator
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.