All Questions
Tagged with javascript regex
37,475
questions
-4
votes
0
answers
32
views
Convert string to a dd/mm/yyyy date format no matter the strings format in JavaScript [closed]
I am trying to create a script in JavaScript where a user can enter a date, can be any format - such as:
September 2021 - November 2024, 01/05/23 - 04/02/24, Sep 2021 - Jan 2024
The possibilities are ...
1
vote
0
answers
29
views
Regexp to select everything except the specified string [duplicate]
I want to write a regexp that selects everything except the given sequence.
the sequence can be at the beginning of a word
the sequence can be in the middle
I was able to write something like this: (...
-1
votes
0
answers
18
views
How to do a replace using regex of a sentence with variable content in the middle and the end containing "/" [duplicate]
I'm having difficulty replacing content where I only know the beginning and end, where it's also a problem to replace due to ("/"). This is the line of code I need to remove.
<div class=&...
-2
votes
0
answers
82
views
Regex for monetary values incorrect matches
My regex should match monetary values, both in EU as US notation (thousands/decimal seperators different). Including optional minus sing ("-") and optional $ or euro sign before the minus ...
-2
votes
0
answers
34
views
How to Validate Phone Number with Country Code in HTML Form and Python? [closed]
I’m working on a web project where users need to enter their Zain Cash phone number, including the country code, in an HTML form. I’m facing an issue with validating this input.
Here’s what I need ...
0
votes
2
answers
78
views
Why do negated character classes in JavaScript Regular Expressions traverse newlines even with multiline mode disabled
Encountered a strange behaviour with negated charatcer classes traversing newlines without m/multiline provided.
> node
Welcome to Node.js v22.7.0.
Type ".help" for more information.
> ...
0
votes
0
answers
26
views
Regex for separating strings that include whitespace with commas [duplicate]
I'm trying to achieve something very simple. I'm writing a Tampermonkey script where I want to be able to input Test, test test, Test 1, T.est 2, te#st 3, test 4 and get as a result ["Test", ...
-1
votes
0
answers
48
views
std::regex is different than Javascript [duplicate]
I thought that std::regex was ECMAScript compatible. However, that does not seem to be true, at least not by default, e.g.
The expression :user will match asd:user in Javascript but not with std::...
0
votes
2
answers
55
views
Javascript Regular Expression Not Failing When I Think It Should [duplicate]
My code:
let g_Check = /^[a-z]+[a-z -.]{0,25}$/i;
let bl = g_Check.test("abc*\"de"); // returns true, when I think it should return false because of the '*' and '\"'
As you can ...
-4
votes
1
answer
49
views
How can i remove everything after the domain(3dmks.eu/(this))? [closed]
Im trying to remove everything that comes after the .eu
The webpage is made in multiple sections and how u scroll u will notice the page is pulling sections.
I would like to remove it but i dont know ...
-3
votes
0
answers
57
views
convert JSON with a regex [duplicate]
{
"Id": 46,
"Catnaam": "salontafels",
"ParentId": 36,
"Overzichtsafb": null
},
{
"Id": 47,
"Catnaam": &...
0
votes
1
answer
43
views
Trying to assert a date format in Cypress that has white space
I am trying to write an assertion in my Cypress test that checks that the date format is mm/dd/yyyy.
Right now, the assertion is failing and I think it's because there is white space at the start and ...
2
votes
2
answers
55
views
Problem with javascript-regex matching, negative look-ahead inside a lookbehind
Given this string: ddd the ! key
and the Javascript regex: / !(?<=(?!the)\w+ !)/
I want to know the reason why the regex does NOT fail.
I expect the regex to fail matching, it doesn't, I don't know ...
0
votes
0
answers
29
views
Is these two regex checker are different /\S+/g (capital "S") and /\s+/g? [duplicate]
function wordCount(val) {
var wom = val.match(/\S+/g);
return {
charactersNoSpaces: val.replace(/\s+/g, '').length,
characters: val.length,
words: wom ? wom.length : 0,
lines: val....
2
votes
2
answers
134
views
Unable to group parts of the regex together to make the intended operator precedence explicit
I’m currently facing an issue with a regex that's causing problems in SonarQube, which requires grouping to make the intended operator precedence explicit. After grouping the regex, it’s not working ...