0
votes
1answer
41 views

Convert JS Regex to PHP Regex

My understanding of Regex isn't great and I need to adapt my working JS code to PHP. This is one of the run-throughs in JavaScript (it finds hashtags and makes HTML anchor tags out of them): exp = ...
3
votes
4answers
59 views

What does this regular expression: /[\[]/?

I am struggling to understand what this means: /[\[]/ Why are there two replace statements? name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
0
votes
2answers
41 views

How To Create A RegEx in Javascript to Validate an Inputbox

I haven't done one before and I need to create a RegEx to validate an input box. # represents a numeric and X represents a letter. The format is: 11111 - XXXXXXX or 11111 - XXXXXXX-XXXXXXXX XXXX ...
1
vote
3answers
66 views

HTML5 Pattern Regex Password Match

Looking for some help for validating password with the following rules: 8+ characters contains at least 1 upper case letter contains at least 1 lower case letter contains at least 1 number Cannot ...
0
votes
3answers
39 views

Javascript regular expression unexpected results

<form name="form1"> <input type="textbox" name="txtInput" /> <script type="text/javascript"> function validate() { if (! document.form1.txtInput.value.match(/\bSun(il)? ...
1
vote
2answers
27 views

How to match a url path with optional elements using regex

I'm using custom URL paths which I want to map into an object. My mapping looks like this: browser://{A}/{B}/{C}/{D}/ with {C} and {D} being optional. So a path might look like this: ...
-6
votes
2answers
51 views

Please tell me JavaScript RegEx for : A.12345678.123 that is start with 'A.' followed by 8 digits [0-9] followed by '.' and again by 3 digits[0-9] [closed]

Please tell me JavaScript RegEx for : A.12345678.123 that is start with 'A.' followed by 8 digits and followed by '.' and again by 3 digits.
1
vote
2answers
41 views

remove extra spaces in string javascript

I'm looking for a function to turn this contains spaces into this contains spacesusing javascript? I've tried the following, using similar SO questions, but could not get this to work. var ...
0
votes
2answers
25 views

Allowing new line characters in javascript str.replace

This question is similar to "Allowing new line characters in javascript regex" but the solution /m not runs with str.replace. You can test the code below at this page <p id="demo"><i>I ...
0
votes
2answers
55 views

Regex for names of sport teams

I'm doing a sports-related quiz in JavaScript/jQuery: http://jsfiddle.net/zVsxf/ I've cobbled some code together from answers on this site and it works fairly well but I have a small problem. I don't ...
2
votes
5answers
41 views

Javascript regex to validate if number begins with leading zero

I need to validate some inputs using a regex. Here are some sample use cases and expected results. 0001 - Matched 001 - Matched 01 - Matched 00.12312 - Matched 000.1232 - Matched 1 ...
0
votes
2answers
23 views

Javascript — call to string.search(/regex/) occaisionally crashes program

I'm writing a native javascript app for android, and it involves a short regex call. The following function should select the inner string from a block of html, shorten it if it's too long, then add ...
2
votes
3answers
58 views

How to split br, p, div tags into an array using regex

I'm attempting to split an html string into an array and failing miserably. The code below is stripping out the "<" and ">" but leaving the tag name. var html = 'line 1 <div>line ...
-6
votes
4answers
68 views

How to add http:// to a string if the string does not contain it? [closed]

I would like to know how to add http:// to a string, by checking beforehand if it's already in the string or not. How can I efficiently transform a string into a full url using only javascript ...
0
votes
6answers
44 views

Get string between last dash and last dot

Simple question, but i don't know regex that much... http://foo.com/bar/image/abc.jpg How get only the abc using regex in javascript?

1 2 3 4 5 520
15 30 50 per page