regex

short regex datetime split

Hi, I'm trying to split the following: 2010-07-30 10:10:50 and I would like to ONLY end up with: 2010 07 30 normally with just the date, you regex with /-/ however now I would like something as simple as that but now i get 2010 07 30 10:10:50 how can i get that last part + space out? Thank you so much! ps, right now I need t...

Is "@" a special character in regular expressions?

I am working on an email filter and I have come across a list of regular expressions that are used to block all emails coming from senders that match a record in that list. While browsing through the list, I have discovered that all occurrences of the @ character are escaped with a \. Does the @ mean anything special in regular expressi...

Assign regex pattern as key to an array.

I have an array of regular expressions and am trying to loop through a text document to find the first pattern, assign that as the key to an array then continue through find the second pattern and assign that as the value. Whenever I come across pattern 1 I want that to always be assigned as a key and all pattern 2 matches that follow un...

i want to capture h4 heading tags which have nothing or spaces in them??

i have the following text obart on 18 September 1905. <h4>(^)</h4>Always known as Jack, he had been in the islands arrived in Rabaul on SS <h4> </h4><i> Montoro</i> to begin a caver, and d="k987" /><a id="k988" /><a id="k989" /><a id="k990" /></p><h4 style="text-align:left;">URGENT – TERRITORY OF NEW GUINEA</h4><br /><div class="quotat...

Using mod_rewrite to redirect unsupported language codes

Hi there- I'm developing a multilingual site, and I'm using language identifiers in urls in conjunction with a front controller such that visiting http://www.domain.tld/en/content or http://www.domain.tld/de/conent will pull up content localised in those languages. If the site is visited without specifying a language identifier, th...

Perl regexp /(\r\n|\r|\n)/

Hi, I want to know how this ambiguous pattern is solved in perl(more generally everything that use libpcre): /(\r\n|\r|\n)/ When the pattern sees \r\n will it match one time or twice? And what is the rules face to this situation? Thanks ...

How to fix this regex?

Help needed to fix one little thing in this regular expression ^\d{2}\-\d{3}\-\d{6} Its validating this format 11-111-111111. It is working fine. but the last one (6 digits) is also validating more than 6 digits. That means if i put 11-111-11111111 (8 digits in last part), the above regex is validating it? Can someone tell me how to ...

recongnize and replace links in yahoo pipes with regex

would there be a formula to recognize any link out of rss feeds and replace them with a fix value with regex in yahoo pipes? ...

Javascript regex - how to get text between curly brackets

Hi, I need to get the text (if any) between curly brackets. I did find this other post but technically it wasn't answered correctly: http://stackoverflow.com/questions/2403678/regular-expression-to-extract-text-between-either-square-or-curly-brackets It didn't actually say how to actually extract the text. So I have got this far: var ...

Nested multi-level optional elements in RegEx

I'm working with VB.NET and I'm working with a RESTful API... They have a construction for selecting resources (Includes) and fields. I've written a wrapper and want to add syntax checking before making any calls. I'm wanting to use RegEX but am struggling to understand and need help. The calling syntax structure is nested up to 3 level...

Regular Expression, match characters between { }

I'm trying to find text that contains a < or > between { }. This is within HTML and I'm having trouble getting it to be "ungreedy". So I want to find text that matches these strings: {test > 3} {testing >= 3 : comment} {example < 4} I've tried a number of regular expressions, but the all seem to continue past the closing } and includ...

TCL Regular Expression Doubt

Hi, As per my understanding of RE --> * means matches 0 or more occurrences of prev regex --> + means matches 1 or more occurrences of prev regex Now lets take a look at the following examples FIRST:- % regexp {:+} "DHCP:Enabled" first 1 % puts $first : --> ":" is stored in variable first % SECOND:- % regexp {...

Why doesn't this positive look-behind assertion work when anchored to the start of the string?

Why doesn't this look-behind assertion work when it's anchored to the front of the string? Run the following code and you'll see that the first test passes but the second, which varies only by the ^ anchor, fails. use Test::More tests => 2; my $s = '/123/456/hello'; $s =~ s{(?<=/)\d+(?=/\d+/hello)}{0}; # unanchored is($s, '/0/456...

Regex exclusion behavior

Ok, so I know this question has been asked in different forms several times, but I am having trouble with specific syntax. I have a large string which contains html snippets. I need to find every link tag that does not already have a target= attribute (so that I can add one as needed). ^((?!target).)* will give me text leading up to 't...

MySQL regexp for matching list of numbers in a string

I have several rows with strings similar to this: 1,19|11|14,2 The info I want to look at is: 19|11|14 (which is a list of the numbers, 19 11 and 14) This info should be matched to see if any of the numbers are in the range between 8 and 13 What's the most effective way to accomplish this? I tried using a regexp like: [^0-9]*(8|9|10|11...

Regex Unclosed Quote

Hi all, I am trying to figure out a way to read a CSV with returns in it in PHP. The problem is when you read the file like this: if (($handle = fopen($file, "r")) !== FALSE) { while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) { row data... } } If you have a retun in the CSV it does not work, it just sees the retur...

Validate string is base64 format using RegEx?

Hi, I have been looking how to validate a base64 string and came across this. ^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$ I need a little help to make it allow "==" aswell as "=". Thanks ...

Positionally matching substrings in Python

How would you parse the ['i386', 'x86_64'] out of a string like '-foo 23 -bar -arch ppc -arch i386 -isysroot / -fno-strict-aliasing -fPIC'? >>> my_arch_parse_function('-foo 23 -bar -arch i386 -arch x86_64 -isysroot / -fno-strict-aliasing -fPIC') >>> ['i386', 'x86_64'] Can this be done using regex, or only using modules like PyParsin...

Regular Expression matching floating point numbers not ending with...

I'm trying to extract CSS positions from a string - example: "top left bottom right center 0 0% 50% 100% 360deg 15.5% -16.3%" The problem is that the string also contains an angle "360deg". I don't want any numbers followed by "deg" to be matched by the regular expression. Currently, I have: (-?([0-9]*\.[0-9]+|[0-9]+))|(center)|(to...

Please help with Python Regex

I have this weirdly formatted URL. I have to extract the contents in '()'. Sample URL : http://sampleurl.com/(K(ThinkCode))/profile/view.aspx If I can extract ThinkCode out of it, I will be a happy man! I am having a tough time with regexing special chars like '(' and '/'. Any help is highly appreciated. Thanks much guys! ...