Tagged Questions
0
votes
5answers
34 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
25 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
41 views
regex to allow only numbers and single dot in jquery
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.
...
1
vote
3answers
45 views
How to remove | Symbol from start and end
I tried the following code to remove | symbol from stand and end bus it does not work.
"|aabckdoio|".replace("/^\|/g","").replace("/\|$/","")
1
vote
3answers
39 views
Allow only 2 decimal points entry to a textbox using jquery?
Allow only 2 decimal points when entering number to a textbox using jquery.
Please suggest any regex to allow only two decimal in textbox.
I have tried the following code.
...
0
votes
2answers
44 views
Regular expression for matching 'A00000' format javascript
I need to match a substring in the format 'A00000', 'B12342', 'W33344' from a string. Basically, first char is always a letter, and following five are numbers.
I have got two regular expressions for ...
-1
votes
3answers
40 views
explain javascript regex by breaking into smaller pieces [closed]
Here is a function to extract the video id from youtube urls.
function youtubeLinkParser(url) {
var regExp = /^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*).*/;
...
0
votes
1answer
37 views
Regular expression for numbers with decimal [duplicate]
In my phonegap app I need to validate the textbox with regular expression which should contain only numbers and two decimal places.
Here is sample I have tried:
rexp: /^-?\d+\.?\d*$/
This code ...
0
votes
1answer
56 views
Parse a large string literal in JS with regex into object array
So, I'm new to programming, but I'm trying to learn JavaScript. Currently I'm working on a project where I'm trying to parse a large text file (the 154 sonnets of Shakespeare found here) into an ...
2
votes
1answer
29 views
Change the backslashes in a URI to forward-slashes with javascript
I'm writing an app that will let the user import pictures. I'm running windows, so the file path that is returned when the user selects a picture has backslashes, which is what I believe to be ...
0
votes
2answers
41 views
Ignore @mentions wrapped in links
Hi I've got a script that parses @mentions into links, but this needs to be loaded more than once and currently it breaks things it has already parsed as links so i need to get it to ignore @mentions ...
0
votes
3answers
39 views
Regex to match @ followed by square brackets containing a number
I want to parse a pattern similar to this using javascript:
@[10] or @[15]
With all my efforts, I came up with this:
@\\[(.*?)\\]
This pattern works fine but the problem is it matches anything ...
-1
votes
5answers
61 views
Check if word exists twice? (Regex) [closed]
I am horrible at Regex, what i want is to check if a string has the word http twice, for example : http://stackoverflow.com/questions/askhttp://stackoverflow.com/questions/ask, using the awesome ...
0
votes
2answers
44 views
Javascript regex to match last word regardless of specials characters
We use this script to alter the last word in a sentence.
$div = $('.cPageHeader h2');
$div.html($div.text().replace(/(\w+?)$/, '<span class="cOrange">$1</span>'));
This works well as ...