regex

Little vim regex

I have a bunch of strings that look like this: '../DisplayPhotod6f6.jpg?t=before&tn=1&id=130', and I'd like to take out everything after the question mark, to look like '../DisplayPhotod6f6.jpg'. s/\(.\.\.\/DisplayPhoto.\{4,}\.jpg\)*'/\1'/g This regex is capturing some but not all occurences, can you see why? ...

Parse error: syntax error, unexpected ',', expecting '}' in here on line 3

function validText ( $input, $min = null, $max = null ) { if ( !empty($min) && !empty($max) ) { $text = "^[a-zA-Z\s0-9]{$min,$max}+$"; } else { $text = "/^[a-zA-Z\s0-9]+$/"; } if ( preg_match( $text, $input ) ) { return true; } else { return false; } } whats the p...

What are the theoretical implications of unbounded lookbehind?

Most languages allow fixed-length or finite-length lookbehind. One notable exception is .NET, which allows the use of the * operator. However, .NET regexs can already recognize balanced parentheses using named capture, which is not a regular language. Are regexs still regular with * in lookbehind? Extended answers for subexpressions ...

RegularExpressionValidator VS Ajax 1.0.20229

We have a website that runs .NET Framework 2.0 with Ajax version 10618. But as it is, that is an old version of the dll, so we planned on switching it to the "newest" version of it for the .NET Framework 2.0, the AjaxControlToolkit version 20229. On our tests, we detected a problem with the ASP control RegularExpressionValidator, whic...

What is the perl format and best regular expression library that compile in MS VC++6.0 ?

I wrote a program in c++ in VC++2008 with boost library for regular expression. But my code must be compiled in vc++6.0 compiler. vc++6 has compile error when using regular expression(I'm not actually sure but I can't compile boostRegex in vc++6). So, for changing my library from boost, what is your opinion to me(one that is more simila...

Simple regular expression to get text between <br/> and next <br/>

I have a string that contains this (and another things): <b>SINOPSIS:</b><br/> Text text text and mooore text...<br/> I need a reg-ex to get the text between those first two <br/> tags. Thanks... Note: There are more <br/> tags. I need the first occurrence only.. I will be using PHPs preg_match() function. ...

htaccess error with redirect when not starting with variables

RedirectMatch (.*).html$ index.php?id=$1 This solution doesn't seem to work and I cant figure out why. Altho, this: RedirectMatch (.*).htm$ $1.html Worked. What wrong with variable not being the first literal in replacement url? ...

Java regex confusion

I hate ask stupid questions like this, but why doesn't my code do what I expect? Java code in a main method: String s = "\"The fat-dog [ruffus] @nd the stupid-cat [*mewzer*] don't like each other!\""; String[] tokens = s.replaceAll("[\\x27]+", "").replaceAll("[^a-zA-z_\\x2D]+", " ").replaceAll("\\s+", " ").trim().split(" "); System.ou...

jquery regex .* not working in jquery

Attemping to use jQuery to find a button on a page "id=btn.ar" using . returns no matches even though the button is clearly on the page. Is there something about .* in jquery being different from other Regex's? The buttons exact id is btnClear so its obvious that btn.*ar should match $("id=btn.*ar") ...

Monster perl regex

I'm trying to change strings like this: <a href='../Example/case23.html'><img src='Blablabla.jpg' To this: <a href='../Example/case23.html'><img src='<?php imgname('case23'); ?>' And I've got this monster of a regular expression: find . -type f | xargs perl -pi -e \ 's/<a href=\'(.\.\.\/Example\/)(case\d\d)(.\.html\'><img src=\'...

Validating US phone number with php/regex

Ok, so I've already got the bulk of this worked out... I've got a function right now that will run a pattern check on the phone number it's given and then determine whether it's a "valid" phone number based on the NANPA guidelines. However, the problem I'm running into is that it allows people to enter "extension" numbers, but I can't f...

Regex Enforcing match

Ok i got this regex: ^[\w\s]+=["']\w+['"] Now the regex will match: a href='google' a href="google" and also a href='google" How can i enforce regex to match its quote? If first quote is single quote, how can i make the last quote also a single quote not a double quote ...

Regex class not working on server side of GWT

I've the following piece of code in the server folder of the module. Pattern regex = Pattern.compile("/(B[A-Z0-9]{9})/"); Matcher matcher = regex.matcher(detailPageUrl); But I still get the following errors: [ERROR] Line 14: The import java.util.regex cannot be resolved [ERROR] Line 15: The import java.util.regex cannot be resolved [...

PHP REGEX: Problem with Smiley `:)` and `:))`

What I want Hi! I want to replace :) to smile.png and :)) to laugh.png. The problem The script finds :) inside :)) so laugh.png is not shown, only smile.png+) This is what I have tried so far for :)): preg_replace("/:)+(?!))/i",$image, $string)) Some other regexes what I tried: "/\:\)+(?=\))/i" "/\:+(?=\)\))/i" But nothing...

Perl Regex syntax

I would like to use Perl to take a previously generated SPSS syntax file and format it for use in an R environment. This is probably a very simple task for those familiar with Perl and regex, but I am stumbling. The steps as I've laid them out for this Perl script are as follows: Read in SPSS file Find appropriate chunks of SPSS fil...

Javascript regex help

Does anybody know how I can make the forwardslash and format: dd/mm/yyyy compulsory in this regex? // Checks a string to see if it in a valid date format // of (D)D/(M)M/(YY)YY and returns true/false function isValidDate(s) { // format D(D)/M(M)/(YY)YY var dateFormat = /^\d{1,4}[\.|\/|-]\d{1,2}[\.|\/|-]\d{1,4}$/; if (dateF...

.NET to Java Regular Expression

I am converting from .NET to Java and the following .NET Regular expression fails. (?<before>.{0,10})" + mSearchTerm + "(?<after>.{0,255}) There are 2 named groups here, but the named part is not important to me. ...

How to use Regex to split data together with extracting pattern value

I have to process text file like that: 2010-04-02 ... ... ... 2010-05-01 ... ... ... It is possible to get values by using Split function: Regex.Split(text, @"\d{4}-\d{2}-\d{2}") Is there way to get dates and related text below the date? My output should be array of items (date, text). Thanks ...

What regular expression can be used for detecting different sports times

I need a regular expression that detects timer strings that could be less than or greater than a minute. So the expression would need to match both: 35.54 and 1:03.24 ...

count and search string from data array

Hello.. I have a database table as follows: line model serial range serial fa01 kd-g335ud 105x0001 105x0001-105x0200 fa01 kd-g335ud 105x0002 105x0001-105x0200 fa01 kd-g335ud 105x0003 105x0001-105x0200 fa02 kd-r311ed 105x0001 105x0001-105x0500 fa02 kd-r311ed 105x0002 105x0...