Tagged Questions
0
votes
1answer
30 views
Check pattern in javascript
I Have next pattern:
[a-z[A-Z]а-я[А-Я][0-9]їЇіІєЄ[-][,]_"/\ ]{0,483}
<input
id="<?= $field['id'];?>"
name="input"
<?php if (isset($field['regex'])) echo ...
0
votes
1answer
35 views
Javascript: Convert string path to a formatted array
So I am trying to use the github api and convert it to use for dynatree.
I am looking to use javascript. But if it's easier done in Ruby, ClojureScript etc that could work as well.
So Github api ...
1
vote
2answers
32 views
Javascript regex split reject null
Is it possible to make a JavaScript regex reject null matches?
Can the String.split() method be told to reject null values?
console.log("abcccab".split("c"));
//result: ["ab", "", "", "ab"]
...
0
votes
4answers
67 views
Add space after slashes that are not part of html tags
I want to add a space after each slash (/) character that is not part of an html tag. So if the content of an element looks like:
<strong>Occupational/technical/eduction/training ...
-3
votes
3answers
54 views
Get an attribute from JSON object
EDIT: As pointed out I have the following JSON object:
Object {name: "red", percent: 36, rgb: "rgb(216,28,63)"}
and I need to extract the percent number and the rgb numbers into 2 separate ...
0
votes
1answer
20 views
Can't get the RegEx right
The function checks out and everything works, I'm really just having trouble getting a pattern search that fits what I want. I'm trying to get a handle on RegEx's but they're a bit confusing to be ...
0
votes
2answers
25 views
Debugging a Javascript RegExp Regular Expression: Validation Hangs on Amazon URL
In using Javascript to validate a URL, I used the following code from an SO answer:
function validateURL(textval) {
var urlregex = new RegExp(
...
1
vote
2answers
83 views
Why my Regex let me write “,” (Comma)?
I have a javascript regex function code above:
function AcceptDigits(objtextbox) {
var exp = /[^\d{1,3}]/g;
objtextbox.value = objtextbox.value.replace(exp, '');
};
Always that I write a ...
0
votes
3answers
52 views
Regex match conditional but dont return it
Here I am trying to get something clear on regexes.
I've created this regex:
a.match( /(@|#)(.*?)(\s|$|\:)/g )
It matches all users and hastags in a tweet.
Problem is they return the condition( ...
0
votes
1answer
56 views
Javascript Date Format Convertion
My objective to get the date in day month year format from a textbox and convert it to mm/dd/yyyy format so that i can compare dates
var userDate = document.getElementById("dateOfJourney").value; ...
8
votes
7answers
791 views
\d only matchs 0-9 digits?
As far as I know, \d should matchs non-english digits, e.g. ۱۲۳۴۵۶۷۸۹۰ but it doesn't work properly in JavaScript.
See this jsFiddle: http://jsfiddle.net/xZpam/
Is this a normal behavior?
-7
votes
0answers
27 views
Please give me a javascript regular expression for following string? [closed]
Given string "2010-UET-GDCB-LHR-42"
at last where 42 is there any 2 digit number can be there. as from 01 - 90.
2
votes
2answers
62 views
Custom RegEx needed
Using javascript, I need to parse the HTML of a page and replace all occurrences of ABC with ABC that occur within a content block such as <p>ABC Company lorem ipsum</p> would be changed ...
0
votes
2answers
44 views
How to split a String by escaping text which are in double-quotes [duplicate]
I have to split an input comma separated string and store the result in an array.
Following works great
arr=inputString.split(",")
for this example
John, Doe =>arr[0]="John" ...
0
votes
4answers
60 views
Matching a Forward Slash with a regex
I don't have much experience with JavaScript but i'm trying to create a tag system which, instead of using @ or #, would use /.
var start = /#/ig; // @ Match
var word = /#(\w+)/ig; //@abc Match
...
1
vote
2answers
42 views
Javascript test method not working ( as expected )
Regular expression
[A-Za-z_-]+
should match strings that only have upper and lower case letters, underscores, and a dash
but when I run in chrome console
/[A-Za-z_-]+/.test("johmSmith12")
...
-3
votes
1answer
51 views
How can I split a string and keep the delimiter? [closed]
How can i convert the string
str = 'a1b22c3';
to an array that looks like "a1; b22; c3" in jQuery?
arr = str.split("(?<=/[a-zA-Z]/)"); // DOES NOT WORK
Thank You!
0
votes
4answers
70 views
RegEx Javascript replace?
I'm trying to make a filter which has a lot of options that get listed in the top of the filter box, now, I'm trying to add the countries and I decided to use regex. But I can't get it to work, for ...
1
vote
2answers
17 views
JS analogue for Excel's regex
I've got an Excel document which uses regex. The expression is like this:
*<*>*
* is any array of symbols (including empty one).
There are some matching strings examples:
abc<>abc
...
1
vote
3answers
47 views
Validate jquery regex - number start with 931
I need to validate number that use inputs into input box.
Number must be exactly 12 characters long and start with 931.
var reg = /^931[0-9]$/;
var val = $("#sms_number").val();
if (val.length === ...
0
votes
2answers
34 views
How to downcase all char and uppercase only the first characters via js?
Now I have this regex:
tSzoveg = tSzoveg.replace(/\b[A-Z]{2,}\b/,'');
It is almost that I want. I want to convert this: THIS IS MINE, NOT YOURS. to this: This is mine, not yours.
How can I convert ...
0
votes
1answer
63 views
RegExp in TypeScript
How can I implement Regexp in TypeScript?
My Example:
var trigger = "2"
var regex = new RegExp('^[1-9]\d{0,2}$', trigger); // where I have exeption in Chrome console
0
votes
1answer
49 views
Javascript Regex for Employee Code prefix validation
I want a single line regex that will check that a string starts with alphanumeric characters followed by a special character ( ) -_ /, and within these special character there can be any alphanumeric ...
0
votes
3answers
38 views
Regex to remove spaces between '[' and ']'
I have been breaking my head on this for sometime now.
In javascript I have a string expression where I need to remove the spaces between '[' and ']'.
For example the expression can be :-
"[first ...
-1
votes
1answer
33 views
Regex error in Netbeans not present in other editors
I have the following regular expression that works fine in my application code and other code editors have not reported a problem with it. It is used to validate a password.
...
2
votes
3answers
42 views
conversion of string containing times to 24-hour times I can do math with - jQuery
I am trying to find a way in jQuery/javascript to reliably convert strings like these:
"10:30 am – 11:00 pm" or this "6:45 am – 9:50 pm"
into two pieces each, 1030 and 2300 or 645 and 2150 ...
0
votes
2answers
21 views
imacro filter spaces from string var
i have a string var
1111 2222 3333 4444
and i want to clear the spaces and return
11112222233334444
im trying to use
SET !VAR1 EVAL(" parseFloat(\"{{!VAR2}}\") ")
but it just returns 1, i ...
0
votes
0answers
28 views
Creating a regex to parse html to MXML syntax
I searched a lot over stackoverflow and found very interesting that's includes:
How to create a Regular Expression for a span attribute?
And
Javascript regex to replace text div and < ...
0
votes
4answers
42 views
How do I write a regex to search for items within UA-Parser?
I am using UA-Parser to create a table of devices for analytics...I have a csv of user-agent strings from our server. I am using the stock UA-Parser for Node package (ua-parser-js.)
However, I am ...
1
vote
1answer
13 views
Removing a timestamp with a JS regular expression
So I'm beginner with js and regexps are a sore spot for me. I need to remove a timestamp from my dropdowns. Here is how it appears:
<option value="Aqua">
<span>Aqua - Available to ship ...