Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
how to include both digits and hyphens in javascript pattern. Like in phone number where user can add both digits and hyphens. No matter where is the hyphen.
The regular expression to make this is so simple. You can make something like this:
([0-9\-]+)
That means all numbers and hypen no matter where is. You can test it here:
https://regex101.com/r/eX3yA7/1
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I have a simple Regex to match 'der' - /der/g
I need the context around the match. Is there any way to build the regex that way? Thank you in advance.
If you want to match the context plus the search string, simply add the optional range before and after the searched string: .{0,5}der.{0,5}
If you want to get the context only, you have to fetch it separately: (.{0,5})der(.{0,5})
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I'm actually looking for a javascript regex for a numeric pattern. Regex should accept any numeric input of below formats but not 0.0.0
Condition:
each segment in the pattern ranges between 0-10
Valid2.9.60.6.1010.10.100.0.1
Invalid0.0.0
Any help would be appreciated..!! Thank you...!!
Just use a negative lookahead:
/^(?!0\.0\.0$)(?:\d|10)\.(?:\d|10)\.(?:\d|10)$/
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
i am using this regex but it still doesn't accept a 'whitespace' input. though it restricts any 'special character'..
.replace(/[0-9]|\W|^\s/,'')
Any help is much appreciated, thanks
You're looking for /[a-zA-Z\s]/. The \s covers spaces (tabs, newlines, etc.). If you literally just want a space " " then change it to /[a-zA-Z ]/.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
am trying to validate relation field which will have alphabets, forward slash and dot for e.g
(s/o. Mr.ram or w/o. Mr.ram), i have already tried this ([a-z])/([a-z]) but it is not working
please help am new to this
thanks in advance
Just tested this in the JS console, you need to escape the slash in regular expressions.
/([a-z])\/([a-z])/
Should do it for you.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I want the regular expression to extract the &[1], &[2},&[3],&[4] values from the following string, with comma delimited.
var str = "Sum({[Account].&[1]+[Account].&[2]+[Account].&[3]+[Account].&[4]})";
Thanks for your help
(&\[\d+\]) Seperates them in to groups, you have to delimit them with commas yourself but that's not a big problem.. :P
Btw.: This is a great test for regex testing purposes http://rubular.com/r/0kLKf1gTaD