How can I detect case sensitive word in regex? [closed] - javascript

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 2 years ago.
Improve this question
How can I detect case sensitive word in regex?
Language: JavaScript
That is, if I am looking for SO
It will trigger for only SO
but not for so or So or sO

add 'i' modifier that means "ignore case"
new RegExp('^' + string + '$', "i")

Related

How to remove the array in a string? [closed]

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 2 years ago.
Improve this question
loginTime: "[2021-01-18 06:18:57.000000]";
I need this to -> "2021-01-18 06:18:57.000000";
how to remove the array and make it just string?
You could use something like this
"[2021-01-18 06:18:57.000000]".replace(/\[|\]/g, '')
Matches the character "[" and "]", replaces them with nothing.

how to make a regex to accept ONLY alphabet and space [closed]

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 ]/.

how to summarize this string in javascript? [closed]

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 9 years ago.
Improve this question
i want summarize this line in javascript!
how is it possible?
var c='['+']'+'('+')'+';'+':'+'<'+'>'+
'='+'<='+'/='+'>='+'+'-'+'&'+'*'+'/'+'=>';
I searched for character escapes but i found nothing!
I think this is what you want:
var opr_re = /\[|\]|\(|\)|;|:|<|>|=|<=|\/=|>=|\+|-|&|\*|\/|=>/;
\ is the escape character in regular expressions.

Email regular expression Javascript [closed]

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 9 years ago.
Improve this question
I have a email regex . But i want to allow only 1 to 20 characters before the # symbol in the regex.
([\w-\"]+(?:\.[\w-\"]+))#((?:[\w-]+\.)*\w[\w-]{0,255})\.([a-z]{2,6}(?:\.[a-z]{2})?)
Any help would be appreciated.
You're better off checking outside of the regex, but there happens to be a way in this specific case:
(?=[^#]{1,20}#)([\w-\"]+(?:\.[\w-\"]+))#...

Regular expression needed [closed]

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

Categories

Resources