AWK Matching Positive and Negative Numbers
I have a data that looks like this: -1033 - 222 100 -30 - 10 What I want to do is to capture all the numbers excluding "dash only" entry. Why my awk below failed? awk '$4 != "-" {print $4}' ...
I have a data that looks like this: -1033 - 222 100 -30 - 10 What I want to do is to capture all the numbers excluding "dash only" entry. Why my awk below failed? awk '$4 != "-" {print $4}' ...
How do I write a Pattern (Java) to match any sequence of characters except a given list of words? I need to find if a given code has any text surrounded by tags like besides a given list of words. For example, I want to check if there are any other words besides "one" and "two" surrounded by the tag . "This is the first tag <span>one<...
Hi All, I have a regular expression, defined in a verbatim C# string type, like so: private static string importFileRegex = @"^{0}(\d{4})[W|S]\.(csv|cur)"; The first 3 letters, right after the regex line start (^) can be one of many possible combinations of alphabetic characters. I want to do an elegant String.Format using the above,...
I get a list of names and need to validate them. Some examples: Elizabeth T. Bang Elizabeth Bang Zaki M. F. El-Adawy joseph m. pastore, jr. Zaki M. F. El-Adawy How can I use regular expressions in Java to validate them? ...
I'm trying to write a very simple parser in C#. I need a lexer -- something that lets me associate regular expressions with tokens, so it reads in regexs and gives me back symbols. It seems like I ought to be able to use Regex to do the actual heavy lifting, but I can't see an easy way to do it. For one thing, Regex only seems to work ...
I'm writing some of my own rules for a few PHP scripts I'm writing, even though I have little experience with regexp. Note: little. Basically I want to pass all URLs except a few as arguments to index.php, rewriting most URLs defined as slugs in a database. ie: /admin, /config, /images, /lib and /template exists, but I do not want to b...
I decided to use Regex, now I have two problems :) Given the input string "hello world [2] [200] [%8] [%1c] [%d]", What would be an approprite pattern to match the instances of "[%8]" "[%1c]" + "[%d]" ? (So a percentage sign, followed by any length alphanumeric, all enclosed in square brackets). for the "[2]" and [200], I already use ...
I thought I understood C# regular expressions, but clearly it's not the case. I need some help devising an expression that would find everything from START|BEGIN until )). Expression can be multi line. Ex. START( FTP_STATE, XXX( VAL( FTP_INITIAL_STATE, 0 ) VAL( FTP_INBOUND, 1 ) AL( FTP_OUTBOUND, 2 ) )) /***********...
Dim re As New Regex("((?<field>[^"",\r\n]+)|""(?<field>([^""]|"""")+)"")((?<rowbreak>,\r\n|\r\n|\n|$)|,)") 3700,Collin,Franc,,[email protected],Collins,Francine,,[email protected],"Enel North America, Inc.",One T Drive,Suite 220,MyCity,MA,77774,1,[email protected],,,,,3700, 3701,Steur,Larry,,[email protected],Steur,Larry,,[email protected],...
I want to parse a random website, modify the content so that every word is a link (for a dictionary tooltip) and then display the website in an iframe. I'm not looking for a complete solution, but for a hint or a possible strategy. The linking is my problem, parsing the website and displaying it in an iframe is quite simple. So basicall...
Can someone explain to me why the following returns empty arrays? $reg = "/(\[{(false|true)};{.+};{\d}\])+/"; preg_match_all($reg,"[{false};{abcde};{10}][{true};{fghij};{10}]",$matches); print_r($matches); ...
I'm new to Perl and am working on a project for school and am stuck. Input: A given text file containing email addresses delimited by a space, tab, ",", ";" or “:” [can be on separate lines]. I am trying to read in the email addresses and put them into an array. I am able to parse the data on one line however if there are line breaks ...
I have a bunch of files that contain a semi-standard header. That is, the look of it is very similar but the text changes somewhat. I want to remove this header from all of the files. From looking at the files, I know that what I want to remove is encapsulated between similar words. So, for instance, I have: Foo bar...some text here...
Does anyone have code for finding a file that contains a regular expression? I would assume you could have two different flavors, one for BREs and one for EREs. You would think some kind of test suites would have something like an isRegex() test. Can anyone have any code? Looking for something comprehensive of course. I see this was...
Hello, I would like to match with RegExp a number between X and Y. Is that possible? ([0-9]+) will match any number, how could I do to match a number between, for instance, 110 and 2234? ...
Hi, Every once in a while I want to replace all instances of values like: <BarFoo> with <barfoo> i.e. do a regular expression replace of all things inside angle brackets with its lowercase equivalent. Anyone got a nice snippet of Lisp that does this? It's safe to assume that we're dealing with just ASCII values. Bonus points for ...
Please can someone tell me a simple way to find href and src tags in an html file using regular expressions in Java? And then, how do I get the URL associated with the tag? Thanks for any suggestion. ...
Which scheme according to you is a better one in case of matching? Is it eregi or stripos or any other method? ...
I have written the folllowing regex and would like to get empty strings removed automatically and could not find any equivalent to RemoveEmptyEntries for Regex which I found only for the Split method in string. string test = "{ key1 = { key2= xx } | key3 = y | key4 = z }"; string[] help = Regex.Split(test, "(=)|({)|(})|(\\|)"); ...
Can anyone suggest a regex to match the underscore in the following examples: test_test test[_test test_] But NOT match this: test[_]test This is using the .Net Regular Expression library. I'm using this RegEx tester to check: http://derekslager.com/blog/posts/2007/09/a-better-dotnet-regular-expression-tester.ashx ...