Hi i want to use regular expression to check if a string is in the format :
1+2 or +12 or 12+ or 1-2 or -12 or 12-. CAn someone help?
techyworld
0
Junior Poster in Training
Recommended Answers
Jump to PostWhat have you tried so far?
Jump to PostThat will check for one or more digits. What is the requirement for your examples?
Jump to PostYou can do:
/[-+]\d{2}|\d[-+]\d|\d{2}[-+]/
All 12 Replies
pritaeas
2,194
¯\_(ツ)_/¯
Moderator
Featured Poster
techyworld
0
Junior Poster in Training
pritaeas
2,194
¯\_(ツ)_/¯
Moderator
Featured Poster
techyworld
0
Junior Poster in Training
pritaeas
2,194
¯\_(ツ)_/¯
Moderator
Featured Poster
techyworld
0
Junior Poster in Training
pritaeas
2,194
¯\_(ツ)_/¯
Moderator
Featured Poster
techyworld
0
Junior Poster in Training
techyworld
0
Junior Poster in Training
pritaeas
2,194
¯\_(ツ)_/¯
Moderator
Featured Poster
techyworld
0
Junior Poster in Training
pritaeas
2,194
¯\_(ツ)_/¯
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.