Tagged Questions
0
votes
1answer
8 views
Regular Expression for Pattern Checking
How to write the Regular expression for my input. my input is
1-10,11-25,26-32,46-83 or 1-24,28,25-27
Condition:
Must start and end with number. no comma or Hyphen.
no two ,, or -- present
...
0
votes
1answer
35 views
Mobile Number Validation (Internationally)
i am trying to do Validation check on mobile number , somewhat similar to what gmail had implemented.
Gmail signup page link
but variation among the phone number across country is to much, so ...
2
votes
2answers
26 views
Regular expressions validates
I'm using this
^\d+(?:fs|sf)[-+]\d+[hmd]$/
regular expression to validate following text
samples:
20fs-4d
10sf+20m
3fs-2h
it is working properly
but even I'm entering first number like (20 ...
0
votes
2answers
35 views
Jquery Remove php code from string
I have a string that contains php code I am trying to find a way to remove the php code from the string.
text = '<?php // This is a test sample ?> This is a description';
...
2
votes
2answers
25 views
Regular Expression to insert using replace method in Javascript
Math.round(num1/num2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")
I have this and if I put
var num1 = 123456789;
var num2 = 10000;
I get 12,346 but I do not understand how it works ...
1
vote
2answers
28 views
Remove slashes from string using RegEx in JavaScript
I am trying to remove all special characters except punctuation from a customer complaint textarea using this code:
var tmp = complaint;
complaint = new RegExp(tmp.replace(/[^a-zA-Z,.!?\d\s:]/gi, ...
0
votes
2answers
41 views
How to replace all capture groups if it is generated dynamically?
Consider the following code:
function Matcher(source, search) {
var opts = search.split('');
for (var i = 0; i < opts.length; i++) {
opts[i] = '(' + opts[i] + ')';
}
...
0
votes
4answers
37 views
Regular expression validation in javascript failing in IE8
trying to use this
(^AD\\[a-zA-Z]+$)|(^ad\\[a-zA-Z]+$)|(^Ad\\[a-zA-Z]+$)
or
^(AD|ad|Ad)\\([a-zA-Z]+$)
in an attempt to validate for strings like AD\loginid or ad\loginid or Ad\loginid
above ...
-1
votes
1answer
27 views
string regex pattern.replace(/\{0\}/, “$0.00”) does not work
Given that:
var pattern = "{0}";
Why does this not work:
pattern.replace(/\{0\}/g, "$0.00");
and yet:
pattern.replace("{0}", "$0.00");
the first results in: "{0}.00"
the second results in ...
1
vote
2answers
45 views
How to match a string that contains given characters in a given order?
For example, i want to match: my_very_nice_file.js and i want to match it with these characters: mrie
m: my
r: very
i: nice
e: file
As you see, these chars are followed by another but they are not ...
3
votes
4answers
37 views
Regular Expression for last value in comma separated listh
I am trying to build a regular expression that returns everything after the last comma in a comma separated list.
// So if my list is as followed
var tag_string = "red, green, blue";
// Then my ...
0
votes
2answers
37 views
ng-pattern for only numbers will accept chars like '-' in angular.js
pattern to make an input text accept only numbers between 0-9.
this is my pattern:
$scope.onlyNumbers = /[\u0030-\u0039]+/g;
for some reason,
chars like '-' will be accepted even though it is not ...
0
votes
2answers
28 views
Why javascript regular expression don't match some emoticons
I implement javascript function which match emoticons key combinations and replace them with the span and particular css class.
I'm sure that I tested system with all supported emoticons and all ...
0
votes
2answers
58 views
How can i clean the spaces and new lines?
I have the following output :
(a lot of new lines here)
Lorem Ipsum is simply dummy text of the printing and typesetting
industry.
Lorem Ipsum has been the industry's standard dummy
...
1
vote
3answers
49 views
Regular Expressions required formate
I want to validate following text using regular expressions
integer(1..any)/'fs' or 'sf'/ + or - /integer(1..any)/(h) or (m) or (d)
samples :
1) 8fs+60h
2) 10sf-30m
3) 2fs+3h
3) 15sf-20m
i tried ...