can you tell me what this regular expression means?
hi im new to regular expressions and would like to decipher this. return preg_replace("/[<>]/", '_', $string); thanks!! ...
hi im new to regular expressions and would like to decipher this. return preg_replace("/[<>]/", '_', $string); thanks!! ...
Let's say we're trying to match SSNs, so the regular expression would be: d{9}. But what if, at run time, I wanted to have, say, the third digit match to 3? So the regex would be d{2}3d{6}. I know that in QTP, you can use regex to match the text property of an object in the Object Repository, but how do I change that regex in QTP code...
Given the following Regular Expression: \b(MyString|MyString-Dash)\b And the text: AString MyString MyString-Dash Running a match against the text never finds a match for the second thing (MyString-Dash) because the '-' (dash) character isn't a word boundary character. The following javascript always outputs "MyString,MyString" to t...
I am doing some fairly extensive string manipulations using regular expressions in Java. Currently, I have many blocks of code that look something like: Matcher m = Pattern.compile("some pattern").matcher(text); StringBuilder b = new StringBuilder(); int prevMatchIx = 0; while (m.find()) { b.append(text.substring(prevMatchIx, m.start()...
I am trying to create a JavaScript regular expression that can find a keyword in the referrers host name. It cannot be in the file path, just the host name. So... these should pass: http://keyword.com/ http://www.keyword.com/ http://keyword.example.com/ http://examplekeyword.com/ But these should not: http://example.com/keyword http:...
Possible Duplicate: What is the best regular expression for validating email addresses? hello, can you help with my coding? my problem is this: when the user wants to register, and when he entered his email. how can i check if it is valid or not? i use this code. please help me. tell me if its correct because i'm only a ...
Given a string of text, in Python: s = "(((((hi abc )))))))" s = "***(((((hi abc ***&&&&" How do I replace all non-alphabetic symbols that occur more than 3 times...as blank string For all the above, the result should be: hi abc ...
I was wondering if there is any php function to convert the number of 1000 to 1,000.00, 10000 to 10,000.00 and so on . I can write a regex but I just want to know if there is any php build in function like floor . ...
I've tried this for the italics: r = re.compile(r"(\*[^ ]+\*)") r.sub(r'<i>"\1"</i>', foo) but it doesn't work, as I am sure anyone in the regex know will see right away. ...
Hey guys can you help me with this. I've got this '/[^A-Za-z]/' but cannot figure out the punctuations part. Gracious! ...
I have data from a CSV file that is enclosed in single quotes, like: 'Company name' 'Price: $43.50' 'New York, New York' I want to be able to replace the single quotes at the start/end of the value but leave quotes in the data, like: 'Joe's Diner' should become Joe's Diner I can do updateString = theString.replace("^'", "").repl...
Similar to my previous question: http://stackoverflow.com/questions/3300433/spliting-a-string-in-javascript The URLs have now changed and the unique number ID is no longer at the end of the URL like so: /MarketUpdate/Pricing/9352730/Report How would i extract the number from this now i cannot use the previous solution? ...
I need to match strings that don't contain a keyword (beta2) at an arbitrary position. Consider: var aStr = [ '/beta1/foo', 'beta1/foo', '/beta1_xyz/foo', 'blahBlah/beta1/foo', 'beta1', '/beta2/foo', 'beta2/foo', ...
Hi! I want to wrap particular lines in a text mass with <b></b> First line in the text All lines with a previous empty line (eg two newlines before) I'm using preg_replace with php, but I'm really shitty with regex. Good tutorials are appreciated. ...
Probably far too easy question, but how do I match a file extension such as .jpg while not matching jpg~ (i.e. a jpg that a program has made a local copy of?) My current line is: for /f %%a in ('dir /b *.jpg') do echo %%~na But if any program has a copy of one of the files open (and thus has made a .jpg~ file) this regexp will match t...
I have a string, say r"a". I want to replace every r"a" with the string r"\1", but my regex engine does not understand this. I have tried: r"\1" -- crashes (can't match group 1 because there is no group 1) r"\\1" -- crashes (not sure why) Is this a limitation of my (proprietary) regex engine, or is it a general problem? Is there an ...
I'm working on some routes for my CodeIgniter application, and I need to declare a 'catch-all'/except one regular expression. Any route that doesn't start with 'ajax/' should be redirected to the 'main'-router. Like so: $route['regexmagichere'] = "main"; So this is definetly way beyond my regex skills and I need some help. The regex s...
I have a file that contains hundreds of lines of the form long long int FILE_FORMAT_HEADER.file.index 1.4 3 I don't care about anything except those two numbers at the end: 1.4 and 3. I'm using the following regular expression: $line =~ m/.+\s+(\d+(\.\d+)?)\s+(\d+(\.\d+)?)/ The idea being to read as much...
I'm having trouble getting regular expressions with leading / trailing $'s to match in Java (1.6.20). From this code: System.out.println( "$40".matches("\\b\\Q$40\\E\\b") ); System.out.println( "$40".matches(".*\\Q$40\\E.*") ); System.out.println( "$40".matches("\\Q$40\\E") ); System.out.println( " ------ " ); System.out.println( "40$"...
Hi, i'm trying to use a regexp to arrange some text, with re.sub. Let's say it's an almost csv file that I have to clean to make it totally csv. I replaced all \t by \n doing : t = t.replace("\n", "\t") ... and it works just fine. After that, I need to get some \t back to \n, for each of my CSV lines. I use for that this expression...