regex

regex to parse a iCalendar file in ActionScript

Hello, I use a library to parse an iCalendar file, but I don't understand the regex to split property. iCalendar property has 3 different style: BEGIN:VEVENT DTSTART;VALUE=DATE:20080402 RRULE:FREQ=YEARLY;WKST=MO The library uses this regex that I would like to understand: var matches:Array = data.match(/(.+?)(;(.*?)=(.*?)((,(.*?)=(.*...

PHP : Pattern Replacement Query.

Currently I have Input: e.g., '123456789'.'+'.'987654321' Desired Pattern: Output: e.g., '123456789987654321' How can I achieve this using in php ? I am not through on regex and so what regex would go in preg_replace for this ? ...

EOL Special Char not matching

Hello, I am trying to find every "a -> b, c, d" pattern in an input string. The pattern I am using is the following : "^[ \t]*(\\w+)[ \t]*->[ \t]*(\\w+)((?:,[ \t]*\\w+)*)$" This pattern is a C# pattern, the "\t" refers to a tabulation (its a single escaped litteral, intepreted by the .NET String API), the "\w" refers to the well know...

Search backward through a string using a regex (in Python)?

Context I'm parsing some code and want to match the doxygen comments before a function. However, because I want to match for a specific function name, getting only the immediately previous comment is giving me problems. Current Approach import re function_re = re.compile( r"\/\*\*(.+)\*\/\s*void\s+(\w+)\s*::\s*function_name\s*\...

In Python, how do I do a string replacement AND retrive the replaced substring?

In Perl, I would write: $x = "abbbc"; $x =~ s/(b+)/z/; print "Replaced $1 and ended up with $x\n"; # "Replaced bbb and ended up with azc" How do I do this in Python -- do a regular-expression string replacement and record what it was that got replaced? ...

How to protect yourself from XSS when you allow people to post RAW embed codes?

Hi. Tumblr and other blogging websites allows people to post embeded codes of videos from youtube and all video networks. but how they filter only the flash object code and remove any other html or scripts? and even they have an automated code that informes you this is not a valid video code. Is this done using REGEX expressions? And ...

Replacing backslash with another symbol in PHP

Hi there, Been struggling with replacing a backslash by another symbol such as '.-.' just to indicate the position of backslashes as I could not send a string such as 'C\xampp\etc.' through url as GET variable so I thought I'd first replace the backslashes in that string by another symbol, then send through url, and then replace them ba...

regexp exclusion

Hello everyone! I have regexp to change smileys to images. Here it is (?:(?![0]:\)|:\)\)|:-\)\)))(:\)|:-\)) The point is not to change 0:) and :)) and :-)) while changing :) and :-) It works pretty well with :)) and :-)) but somehow still grabs :) in 0:) Where's my mistake? ...

replace string in preg_replace

<?php $a="php.net s earch for in the all php.net sites this mirror only function list online documentation bug database Site News Archive All Changelogs just pear.php.net just pecl.php.net just talks.php.net general mailing list developer mailing list documentation mailing list What is PHP? PHP is a widely-u...

Please help me find the regex for the following pattern

Hi, I want a regex pattern to find all the words of this format [xyzblab23la]. For example if the text has something like the following, Lorem Ipsum dolor[32a] ameit[34] I should be able to find the [32a] and [34]. Please tell me what is the regex for this pattern? ...

How does Perl's grep function work with a regex?

Hi, How does the following grep function works (what does !/0o1Iil]/ do? ) @chars = grep !/0o1Iil]/, 0..9, "A".."Z", "a".."z"; use Data::Dumper; print Dumper @chars; to produce the following in @chars? $VAR1 = 0; $VAR2 = 1; $VAR3 = 2; $VAR4 = 3; $VAR5 = 4; $VAR6 = 5; $VAR7 = 6; $VAR8 = 7; $VAR9 = 8; $VAR10 = 9; $VAR11 = 'A'; $VAR1...

regular expression

Hi I need a regular expression that'll give me something like this part ./something\", [something.sh from something like this string ("./something\", [something.sh", ["./something\", [something.sh"], [/* 37 vars */]) is that possible? I'm having real trouble making this since there's that \" escape sequence and also that ',' chara...

Get images from a URL and retrieve them all to select the one which is the biggest.

I want to open a URL and RegEx all the image's URLs from the page. Then I want to cURL all of them and check what size they have. In the end I want to get the biggest one. How do I do this? ...

REGEX (.*) and newline

How can I fix this? REGEX: //REGEX $match_expression = '/Rt..tt<\/td> <td>(.*)<\/td>/'; preg_match($match_expression,$text,$matches1); $final = $matches1[1]; //THIS IS WORKING <tr> <td class="rowhead vtop">Rtštt</td> <td><img border=0 src="http://somephoto"&gt;&lt;br /> <br />INFO INFO INFO</td> </tr> //THIS IS NOT WORKING...

Is there a regular expression to remove a trailing slash in Perl?

I would like to remove a trailing slash from a string. For example if i have a string called $test = "test/". How would I remove the slash at the end? ...

Why this C# Regular Expression crashes my program?

using System; using System.IO; using System.Net; using System.Text.RegularExpressions; namespace Working { class Program4 { static string errorurl = "http://www.realtor.ca/propertyDetails.aspx?propertyId=8692663"; static void Main(string[] args) { string s; s = ge...

Regular Expression to parse a string from end until a delimiter is reached(Perl)

Hello, I need a regular expression to parse a text The directory is /home/foo/bar/hello.txt. I would like to get the hello.txt and get rid of the rest of the directory, so i would like to delete home/foo/bar/ and only get the hello.txt ...

best REGEXP friendly Text Editors + most powerful REGEXP syntax?

I am fluent with Microsoft Visual 2005 regular expressions and they are a big time saver. I seem to learn them best by having a vaguely organized cheat sheet thrown at me, at which point I read just a little and play with them until I understand what's going on. That learning approach has worked well for me, for now. I would really lik...

Regular expression to match text that doesn't start with substring?

I have text with file names scattered throughout. The filenames appear in the text like this: |test.txt| |usr01.txt| |usr02.txt| |foo.txt| I want to match the filenames that don't start with usr. I came up with (?<=\|).*\.txt(?=\|) to match the filenames, but it doesn't exclude the ones starting with usr. Is this possible with regular...

mass add time in a file

i have a file in which time appears nearly hundred times like 00:01:32 00:01:33 00:01:36 ....................... how can i add 2 seconds or 2 minutes to all the times in the file so that i get 00:01:34 00:01:35 00:01:38 .................. ...