Skip to content
Advertisement

Tag: regex

How to remove char from regex

I’m not got, yet, with regex. I’ve been trying to break my head to get this to work. I need a regex that allows the user to enter Any alphabetical char (a-z) Any number For special char only “-” and “_”. “@” is not allowed. I got this but no dice. [^a-zA-Z0-9] Thanks Answer will match a string following the

Javascript Regex to match everything after 2nd hyphen

I’m trying to find a JavaScript regex pattern to match on everything after the 2nd instance of the hyphen – Here is an example: In this case, I’d like to only match the address so the desired variable to store would be: These characters 1 and H6205636 can change in length so I don’t think a pattern that matches on

Regex to capture the group

I have a text where I want to capture email with line starting from “Email: ******” I have tried with .match(/Email:(.*)1/g) But I am getting [Email:] instead of 7c92e312-93d5-4354354-45435435@email.webhook.site How do I get the matching email from the group Answer You need to access the first capture group. But I would use this version:

Remove all elements in an array that contain a certain character [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 5 months ago. Improve this question I have a Javascript array var array = [“1-2”, “3-6”, “4”, “1-6”, “4”] and want to remove all elements that contain the variable var m

Search for regex terms independent of symbol

So I have this string right here, it’s a registration number: 12.325.767/0001-90 And I want to create a regex when I type “23”, return for me the “2.3” or if I type “700”, return for me “7/00” or if I type “19”, return “1-9”. So, I want to get the number even if there is a symbol in the middle.

Advertisement