regular expression
i have this regular expression: ^\$?(\d{1,3}(\,\d{3})*|(\d+))(.\d{2})?$ however it is failing when i have an amount such as this: 41022095.6 anything i am missing? ...
i have this regular expression: ^\$?(\d{1,3}(\,\d{3})*|(\d+))(.\d{2})?$ however it is failing when i have an amount such as this: 41022095.6 anything i am missing? ...
Initial Googling indicates that there's no built-in way to do regular expressions in an Objective-C Cocoa application. So four questions: Is that really true? Are you kidding me? Ok, then is there a nice open-source library you recommend? What are ways to get close enough without importing a library, perhaps with the NSScanner class? ...
Here's a piece of code to take a string (either NSString or NSAttributedString) input that represents a command line and parse it into two strings, the command cmd and the arguments args: NSString* cmd = [[input mutableCopy] autorelease]; NSString* args = [[input mutableCopy] autorelease]; NSScanner* scanner = [NSScanner scannerWithStri...
I've been trying to find a way to match a number in a Javascript string that is surrounded by parenthesis at the end of the string, then increment it. Say I have a string: var name = "Item Name (4)"; I need a RegExp to match the (4) part, and then I need to increment the 4 then put it back into the string. This is the regex I have s...
I need C# string search algorithm which can match multiple occurance of pattern. For example, if pattern is 'AA' and string is 'BAAABBB' Regex produce match result Index = 1, but I need result Index = 1,2. Can I force Regex to give such result? ...
I have the following RegEx id=(.*?) | id="(.*?)" The reason for this is I am trying to replace Ids from the browsers DOM using JavaScript. IE, however strips quotes from element atributes as it appears not to require them in the DOM The problem I have is that the backrefererences from each alternate statement are in separate groups (...
How do I write a .net regex which will match a string that does NOT start with "Seat" ...
I don't think this is possible with just regular expressions, but I'm not an expert so i thought it was worth asking. I'm trying to do a massive search and replace of C# code, using .NET regex. What I want to do is find a line of code where a specific function is called on a variable that is of type DateTime. e.g: axRecord.set_Field("...
In my C# application, I use a regular expression to validate the basic format of a US phone number to make sure that the user isn't just entering bogus data. Then, I strip out everything except numbers, so this: (123) 456-7890 x1234 becomes 12345678901234 in the database. In various parts of my application, however, I would l...
Is there any implementation of regex that allow to replace group in regex with lowercase version of it? ...
How to extract a text part by regexp in linux shell? Lets say, I have file where in every line is an IP address, but in different position. What is the most simple way to extract those IP addresses using common unix command-line tools? ...
Hi, I've got a bunch of strings like: "Hello, here's a test colon:. Here's a test semi-colon;" I would like to replace that with "Hello, here's a test colon:. Here's a test semi-colon;" And so on for all printable ASCII values. At present I'm using boost::regex_search to match &#(\d+);, building up a string as I process e...
This is just a question to satisfy my curiosity. But to me it is interesting. I wrote this little simple benchmark. It calls 3 variants of Regexp execution in a random order a few thousand times: Basically, I use the same pattern but in different ways. Your ordinary way without any RegexOptions. Starting with .NET 2.0 these do not ge...
I have the following regex: (?!^[&#]$)^([A-Za-z0-9-'.,&@:?!()$#/\])$ So allow A-Z, a-Z, 0-9, and these special chars '.,&@:?!()$#/\ I want to NOT match if the following set of chars is encountered anywhere in the string in this order: &# When I run this regex with just "&#" as input, it does not match my pattern, I get an error...
Hi, I need to extract options in ``particular select tag. Is it possible to accomplish using one regex or I'll have to capture the inner html of select first and then the options? Here is an example of html: <select id="select_id"> <option selected value="">Select Type</option> <option value="1">1</option> <option value="2...
Assume infile is a variable holding the name of an input file, and similarly outfile for output file. If infile ends in .js, I'd like to replace with .min.js and that's easy enough (I think). outfile = re.sub(r'\b.js$', '.min.js', infile) But my question is if infile ends in .min.js, then I do not want the substitution to take place. ...
I would like to be able to match a string literal with the option of escaped quotations. For instance, I'd like to be able to search "this is a 'test with escaped\' values' ok" and have it properly recognize the backslash as an escape character. I've tried solutions like the following: import re regexc = re.compile(r"\'(.*?)(?<!\\)\'") ...
Hi, I hope this question is not a RTFM one. I am trying to write a Python script that extracts links from a standard HTML webpage (the <link href... tags). I have searched the web for matching regexen and found many different patterns. Is there any agreed, standard regex to match links? Adam UPDATE: I am actually looking for two diffe...
I think I must just be really tired, because this should be really simple, but it's just not working for me. I want to match a portion of a string using a regex and then access that parenthesized substring. var myString = "something format_abc"; // I want "abc" var arr = /(?:^|\s)format_(.*?)(?:\s|$)/(myString); console.log(arr); ...
I came across a strange behaviour when doing some regexes in Javascript today (Firefox 3 on Vista). var str = "format_%A"; var format = /(?:^|\s)format_(.*?)(?:\s|$)/.exec(str); console.log(format); // ["format_%A", "%A"] console.log(format[0]); // "format_undefined" console.log(format[1]); // undefined There's nothing wrong with ...