Skip to content

Tag: regex

Regex for String in React

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 a…

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-string1234567891230oka…

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 o…

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…

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 fo…