1
vote
4answers
90 views
RegEx for Javascript to allow only alphanumeric
I need to find a reg ex that only allows alphanumeric. So far, everyone I try only works if the string is alphanumeric, meaning contains both a letter and a number. I just want one …
0
votes
4answers
183 views
Regular expression for allow only numbers
Hi friends,
I want to check the following with regular expression
{Today,Format}
Today - will be remains as it is.
In the place of Format, we can allow the digits from 0 to 12.
…
4
votes
2answers
63 views
Javascript - MultiLine RegExp: lastIndex stuck on newlines?
Some Context
From Javascript: The Definitive Guide:
When regexp is a global regular expression, however, exec() behaves in a slightly more complex way. It begins searching st …
2
votes
4answers
189 views
javascript regex to extract anchor text and URL from anchor tags
Hello, I have a paragraph of text in a javascript variable called 'input_content' and that text contains multiple anchor tags/links. I would like to match all of the anchor tags an …
1
vote
4answers
201 views
Easiest way to split string into Key / value
What's the best way to extract the key and value from a string like this:
var myString = 'A1234=B1234';
I originally had something like this:
myString.split('=');
And that wo …
1
vote
3answers
125 views
Search Javascript Array for Regex and return True/False (0/1) if found
I need to know how I can search an array for some literal text and have it used as a condition whether to continue.
Heres why:
Each time I execute a function I am pushing the ID o …
1
vote
2answers
52 views
Is there a way to use ungreedy matching in JavaScript for regular expressions?
I wonder if there is a way to use ungreedy matching in JavaScript? I tried the U modifer, but it doesn't seem to work.
I want to write a small BBCode parser in JavaScript, but wit …
2
votes
1answer
54 views
Replacing a word with another word zero or more times in javascript using regular expressions
I have a word : [lesserthen] , that I need to replace with < zero or more times in a string. I'm using the String.replace method to do so. But the word is only replaced one ti …
1
vote
5answers
116 views
Need help refining this javascript regex
I have the following very simple Javascript-compatible regular expression:
<script type="text/javascript" id="(.+)" src="([^"]+)">
I am trying to match on script tags and …
0
votes
3answers
110 views
Regexp: Remove quotation marks from json list
I've got an array of objects in json format: [{"name":"obj1", "list":["elem1", "elem2", "elem3"]}, {"name":"obj2", "list":["elem4", "elem5", "elem6"]}]
Now I'd like to construct r …
1
vote
3answers
256 views
Javascript Regexp - Match string pattern except if string is inside specified tag
Hello
I am trying to replace all occurences of ???some.text.and.dots??? in a html page to add a link on it. I've built this regexp that does it :
\?\?\?([a-z0-9.]*)\?\?\?
Howev …
0
votes
1answer
89 views
Shorten URL value as Javascript variable
I'm using the jQuery Treeview plugin for navigation on a site with nested levels of categories. In each category there are then products, each of which have one or more information …
2
votes
6answers
172 views
Regex match question
In javascript, I've got a block of HTML like this:
<h2>{title}</h2>
<p><a href="{url}">{content}</a></p>
And I'm trying use regex "match" to …
2
votes
3answers
138 views
Javascript + unicode
Hi,
Does anyone know of any JavaScript libraries that support Unicode-aware regular expressions? For example, there should be something akin to \w that can match any code-point in …
6
votes
9answers
422 views
Is there a version of JavaScript’s String.indexOf() that allows for regular expressions?
In javascript, is there an equivalent of String.indexOf() that takes a regular expression instead of a string for the first first parameter while still allowing a second parameter …