Tagged Questions
0
votes
1answer
21 views
regex match list of classes using and/or
I'm trying to figure out how to match a set of specific classes -
I want to match classes inline AND/OR a (set of) colors only, either on their own or 2 together:
<span class="inline"> ...
2
votes
3answers
42 views
How to replace duplicated 'slash' into a single slash from a string?
How can I replace duplicated 'slash' from a string?
For instance,
str = '/estate//info//';
alert(fragment.replace(/\/\/+/, "/"));
result,
/estate/info//
But I am after,
/estate/info/
0
votes
2answers
46 views
Replace double period to single and if 4 or more replace to three
If there is two periods(..) replace with one (.) and if there is four or more period(....) replace it with three(...).
Require both option working at same time
i try this way
var fieldval = test..
...
2
votes
5answers
37 views
regexp to quote only string matches (not numbers)
I'm struggling with string:
"some text [2string] some another[test] and another [4]";
trying to quote every value but number within [], so it could be converted into
"some text ['2string'] some ...
1
vote
1answer
55 views
Javascript, pattern Regex
Originally I had a text like this;
asa#fathernode
{oi#string
oi2#string}
My script get an array like this (because other treatments are happening):
[ "asa#fathernode" , "{oi#string" , ...
0
votes
2answers
29 views
Remove meta tag with parent paragraph tag
i wanted to remove meta tag with parent paragraph tag in below code.
<p>
<meta content="text/html; charset=unicode" http-equiv="Content-Type" />
</p>
<p>
<meta ...
0
votes
2answers
19 views
regexp to modify matches with replace pattern
The string:
'some text [2string] some another [test] and [test-]'.match(/\[\D+?\]+/g);
How to modify regexp i've written to match also [2string] (string with integer), and replace all the matches ...
0
votes
2answers
30 views
Split protocol name from URL
Trying to split the http:// from http://url.com/xxyjz.jpg with the following:
var imgUrl = val['url'].split(/(^http:\/\/)/);
And, even though I can get my desired result with the code above, I get ...
3
votes
4answers
47 views
Inserting line numbers using Javascript regex?
suppose a user paste this code in text box :
public static void Main()
{
int a=1+1;
int b=1+1;
}
I want to find in regex all the begining of lines and to ...
0
votes
1answer
41 views
Javascript regex: how to match on the whole text?
I can't seem to find a way for a javascript regex to match on the whole text, and not line by line. I'd like that the regex engine do not regard '\n' as the end of the text, but as a character like ...
1
vote
2answers
65 views
need help validating if a date is in the past using javascript
Hi I am currently stuck on how to carve up my regex date to then test if the date entered is in the past . if it is I would like to alert this.
I know i some how need to splice my regex but im unsure ...
1
vote
2answers
45 views
How to stop indenting HTML source creating whitespace in pre/code tags?
I currently have the following html within a pre-code block
<pre class="prettyprint"><code>
<html>
...
0
votes
3answers
25 views
JavaScript match before and after underscore
I have an array in JavaScript. Items in the array are like below:
var people = new Array("michael_51", "mark_57", "graham_44", "paul_22");
I would really like to split the elements before and after ...
-3
votes
5answers
40 views
Character '^' with regular epxression in javascript [closed]
Is there a way to have the character ^ taking into account when doing regxep matching in javascript? It seems to be a special characater, as:
"x^2".match( /[A-z]+[0-9]*/)
returns:
["x^2"]
...
0
votes
2answers
25 views
Matching regex patterns in order
I am building a mini parser which will take images or attachments and build an array of the data for my own use later.
I can successfully parse my data with my patterns, however, the way that I am ...