Regular expression for an indian mobile number with +91? [duplicate] - javascript

This question already has answers here:
regular expression for Indian mobile numbers
(18 answers)
Closed 5 years ago.
I'm trying to write a regular expression for an indian mobile number with +91 as optional before the number
The regEx that I have written is below:
^[\+91]?[7-9][0-9]{9}$
This isn't working properly, please help.

I think this should work. I've tested it on https://regex101.com/
/^((\+91?)|\+)?[7-9][0-9]{9}$/

Related

How to show a string as its unicode code points? [duplicate]

This question already has answers here:
Need to escape non-ASCII characters in JavaScript
(4 answers)
Javascript, convert unicode string to Javascript escape?
(6 answers)
Closed 1 year ago.
Just from a browser developer console or Node.js repl, what's an easy way to transcribe a string as its unicode representation? For example I can input '\u0048\u0065\u006C\u006C\u006F' and the repl will show me 'Hello'
> '\u0048\u0065\u006C\u006C\u006F'
"Hello"
How can I reverse this?
> something('Hello')
"\u0048\u0065\u006C\u006C\u006F"
For example. I hope there are some convenient built-ins or browser console/repl support.

Regular Express to Grab first dollar amount [duplicate]

This question already has answers here:
Java Regular Expression to match dollar amounts
(6 answers)
Regular expression to match dollar amounts
(4 answers)
Closed 2 years ago.
Looking out first $ Symbols amount
$647.50 (Save $94)tried this code regular express: .match(/$(\d+)/);
But Does not working
OutPut Looking
647.50
[$](\d+).(\d+)
You have tried this it's working

How to convert PHP Regex to jQuery Regex [duplicate]

This question already has answers here:
Match only unicode letters
(3 answers)
Closed 4 years ago.
I have this PHP regex:
/^[\p{L}\p{M}]+[\p{L}\p{M}\-\s]*$/u
and I want to convert it to jQuery. I tried multiple solutions that I found online, but nothing really worked. I tried using
new RegExp("/^[\p{L}\p{M}]+[\p{L}\p{M}\-\s]*$/u");
but that didn't help.
This is because \p{L} and \p{M} don't exist in the JavaScript RegEx engine. This answer provides solutions for matching Unicode categories: https://stackoverflow.com/a/26659285/1920035

What would be the regular expression to accept only 2 bytes accented characters with spaces? [duplicate]

This question already has an answer here:
Reference - What does this regex mean?
(1 answer)
Closed 4 years ago.
I have a text field in which I have to accept only 2 bytes accented characters, in whatever language it is. i.e. whether it is french, german, spanish, etc.
I used this regex : /^[A-zÀ-ÿ\\s]*$/
But it does not accept the character : ¢
Thanks in advance
I got the solution from other source. it can be done without regular expression also.
Javascript function is created which calculates the bytes for each character. and validate if it more than 2 bytes or not.

Omit 'e+' suffix on a number in JavaScript [duplicate]

This question already has answers here:
How to avoid scientific notation for large numbers in JavaScript?
(27 answers)
Closed 8 years ago.
Sometimes numbers are displayed like this: 7.92436555894648e+29. How can I display them in full?
Alright, I got it. I'll use a third-party BigNumber library. Thanks.

Categories

Resources