How shall we write a regular expression to validate a string that should have a length of a minimum of 1 character and a maximum of 50 characters, have both upper case and lower case, alphanumeric, include space, and have mostly used special characters like @,._-&$#? The first character should be either alphabet or number then the rest can be
Tag: regex
Remove dots and spaces from strings
I want to remove dots . and spaces with regex text.replace(/[ .]+/g, ”). This is an 8-string 12.34.5678; and this is another 13-string 1234 5678 9123 0 okay? But the main problem is that it removes all dots and spaces, from the sentence. Thisisan8-string12345678;andthisisanother13-string1234567891230okay? an 8-string 12.34.5678 another 13-string 1234 5678 9123 0 Needs to be converted to. an 8-string
regexp highlight search matching numbers
I’ve got a script from a friend, and tried to modified it. So that it highlights a string of numbers in a div. The problem is, that the output of the highlighted text becomes the regexp. Any solutions, what I’m doing wrong? https://jsfiddle.net/rrggrr/kgd4swha/6/ Answer Here’s a simple way of doing it: Use a string#replace using /(9756[0-9]{8})/g as the regex to
Is it possible to give Regex a min Value? [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 Hey I have a working regex that really does the job it should. One thing I would like to add or change is that the
How to grab a specific text value from a big text or html file [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 2 years ago. Improve this question I would want to get only the path value form the below text/html. Actually it contains 10k lines, it would
Password regex that requires โat least two ofโ certain characters
Im working on javascript regex which includes having following conditions. So far with no luck. -The minimum character count allowed is 8. -The maximum character count allowed is 64. -The entered text should include at least two of the following – numbers, lowercase letters, uppercase letters, Special characters. -Entering symbols will not be supported. So far what I have is
How to extend regex to accept @ in image urls
I have a regex for validating image urls, however some of the images are using @ for example: https://test.com/image-name@2x.jpeg. How can I extend this regex to accept also the @ character inside of the image link? Current regex look like this Answer If it can only be part of the image name, you can add a forward slash followed by
How to use straight and smart quotes in auto-replace script for textarea?
I’m really stuck again on how to properly combine these lines to auto-replace straight quotes into smart ones in the text area. It was working earlier, however after I added a line to fix the cursor going at the end after replacing a character. Here’s what is currently looks like: Commas, semicolon, period, em dash, and double spaces is working
How to replace all the special character who follows another character
I have a long string containing some special characters. I need to check those special characters who do not follow space and replace it with a special character and space. Example Input Output Here you can see the last < replaced with < as it follows z which is not space. Keep this in mind in the HTML the special
Javascript use RegEXP to remove characters between (but not including) special characters
I have a string as follows: I’m trying to get rid of the characters between the backslashes. Wanted result: I know how to remove everything except characters between two special characters WITHOUT removing the special characters. Every answer on stack includes removing them too ๐ Answer Put the backslashes in the replacement string. Note that you need to double them