Tagged Questions
1
vote
1answer
44 views
Why does this regex make Chrome hang?
Try typing this into Chrome's JS console. It's a regex I found to check if something's a valid URL or not:
"http://www.kvraudio.com/".match(/^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w ...
0
votes
4answers
36 views
How to replace everything after first instance of character in a string
I want to remove everything except the words before the first comma in a string containing several comma-delimited values:
ie - Value One, Value Two, Value Three, Value Four
I am looking to isolate ...
0
votes
4answers
41 views
Remove brackets and trailing whitespace from variable
What would be a good regex for removing brackets and any (but only) trailing whitespace?
Example: "Hello [world] - what is this?" would translate to "Hello - what is this?".
0
votes
2answers
42 views
javascript/jquery remove relative path from url
I'm using jquery to find and retrieve several img src's from the DOM, however the src's are in relative path format like this:
...
0
votes
5answers
39 views
Javascript check Url and if the Url contains a string
I have this function that checks if the entered Url is valid.
The problem is that I also need to know if this Url comes from facebook.com or not.
If not the Url should not be considered as valid.
How ...
-3
votes
0answers
45 views
Converting regex from C# to Javascript [closed]
Can anyone please help me to convert this C# regex to its Javascript equivalent:
^0[234586789]{1,2}(\-)?[^0\D]{1}\d{6}$
When I'm using it in c# it works fine but in javascript it doesn't work.
1
vote
2answers
47 views
How do I check if a string would make a valid html ID using JS?
I have a variable word that populates with various strings and than becomes an id for a new element. I want to check and make sure the string would make a valid html ID. I came across the regex in ...
0
votes
1answer
22 views
Javascript : Empty String Match In Regular Expression
i want to match the url with contatin http/https and (www) or without (www)with the help of regular expression. following is my regualr expression
^((https?)://)(www\\.)| ^$ ...
5
votes
4answers
50 views
Regex for Password validation in Javascript
Regex Password complexity requires that any three of the following four characteristics must be applied when creating or changing a password.
Alpha characters - at least 1 upper case alpha character
...
0
votes
3answers
32 views
Regex Matching - Content within brackets
This is a fast question, I just don't know many Regex tricks and can't find documentation for this exact point:
Lets say I have the string:
'I know [foo] and [bar] about Regex'
I want to do a JS ...
8
votes
4answers
65 views
RegEx match a number at the end of a string
I'm trying to match a number at the end of a string, using a regex. For example, the string might look like:
var foo = '101*99+123.12'; // would match 123.12
var bar = '101*99+-123'; // would match ...
0
votes
6answers
65 views
Parsing 'min:sec' string with a regex
I'm trying to parse a string containing minutes and seconds separated by :. Both min and secs are optional (one needs to be provided though). Here is what I expect to get from my regex:
'0' // ...
0
votes
2answers
29 views
JavaScript replace part of string regex
Hey guys i need to replace a string which starts every time with the same parts. Such as…
var name = $('.item').attr('name'); // Could be »item-name-XYZ« (XYZ) differs each time.
...
0
votes
2answers
27 views
Regex, any combination of select characters and case sensitive
I'm trying to write a regex that matches any combination of the letters A,N,X and fullstop
It needs to be case sensitive too...
example of working values
A
X
ANX
AA.
AA.XX
AA.NN.XX
A.X.N
XXX.XXX.XXX
...
0
votes
5answers
51 views
regex to allow only numbers and single dot in jquery [duplicate]
Regex to allow only numbers and single dot when entering number to textbox in jquery.
Please suggest any regex to allow only numbers and single dot in textbox.
I have tried the following code.
...