regex

Removing XML entities from string in Ruby

Hi, I try to parse RSS chaanal with simple-rss lib. Unfortunately I got a lot of garbage in node: <description>&lt;p&gt; some decryption &lt;/p&gt; &lt;a href="http://url.com/trac/xxx/wiki/foo?action=diff&amp;amp;amp;version=28"&amp;gt;(diff)&amp;lt;/a&amp;gt;&lt;/description&gt; I need to retrieve text ("some description") and o...

Regular expression to match empty HTML tags that may contain embedded JSTL?

I'm trying to construct a regular expression to look for empty html tags that may have embedded JSTL. I'm using Perl for my matching. So far I can match any empty html tag that does not contain JSTL with the following? /<\w+\b(?!:)[^<]*?>\s*<\/\w+/si The \b(?!:) will avoid matching an opening JTSL tag but that doesn't address the wh...

Need regex pattern to capture pieces of formula

I need to extend a regex pattern in C#. The current pattern is capturing any multiplication or division in the formula: ([\+-]?\d+,*\d*[eE][\+-]?\d+|[\-\+]?\d+,*\d*)([\/\*])(-?\d+,*\d*[eE][\+-]?\d+|-?\d+,*\d*) That means that if the expression is e.g. 12+18*3+4-3/3, it will capture 18*3 and -3/3. That is great. Now I need to extend...

Get the array of strings by matching the pattern in the given string

I have a pattern @@{} and given a string I need to find out all the strings coming in between the curly braces. Example : If my string is Hi This is @@{first} and second is @@{second} along with third @@{third} string The output I expect is a string array consisting of elements: first second third My Java code for this goes...

Search MultiByte Strings using RegEx C# Winforms

I am working on html documents using WebBrowser Control, I need to make a utility which searches a word and highlights it in the browser. It works well if the string is in English, but for strings in other languages for example in Korean, it doesn't seem to work. The Scenario where the below mentioned code works is- Consider user has s...

php regex for string containing a "." and "-"

Hay all, i need help making a regex. The string must contain a "-" and must not contain a ".". Can someone help me please. ...

Java RegEx - Regular expression to split a paragraph with start and end ....

Hi All, I am new to java regex.Please help me. Consider the below paragraph, Paragraph : Name abc sadghsagh hsajdjah Name ggggggggg !!! Name ggg dfdfddfdf Name !!! Name hhhh sahdgashdg Name asjdhjasdh ...

How to extract a string using Javascript Regex

Hi all, it might look obvious but I wasted too much time trying to get it to work... I'm trying to extract a substring from a file with Javascript Regex. Here is a slice from the file : DATE:20091201T220000 SUMMARY:Dad's birthday the field I want to extract is Summary, so I'm trying to write a method that returns only the summary t...

I want a small regex that accepts a var(int,enum1,enum2) in C#

Dear All, I have never dealt with regular expressions before, and I am facing a problem here. The user has to input a text like Var1(0,enum1,enum2), and I have to check the syntax on the following manner:- 1- make sure Var1 name matches the list of variables I have.. Just a string comparison 2- make sure the parameters are input in se...

Regular expressions???

Can anyone tell me where I could start learning the usage of regular expressions in mvc applications? Thanks Ritz ...

Complex Regex getting value from string

Here are some input samples: 1, 2, 3 'a', 'b',    'c' 'a','b','c' 1, 'a', 'b' Strings have single quotes around them, number don't. In strings, double single quote '' (that's two times ') is the escape character for single quote '. The following also also valid input. 'this''is''one string', 1, 2 '''this'' is a weird one', 1, 2 ''''''...

Multiline Regular Expression with Erlang re module

Hi, Failed to get Erlang re work for multiline, please help! > re:run("hello,\nworld", "o,.*w", [multiline]). nomatch > re:run("hello,\nworld", "o,.*w", [multiline, {newline, lf}]). nomatch > {ok, MP} = re:compile("o,.*w", [multiline]). {ok,{re_pattern,0,0, <<69,82,67,80,55,0,0,0,2,0,0,0,7,0,0,0,0,0,0,0,111,0, ...

PHP Determining a file based on parameters in regular expression

I'm trying to determine a file based on specific parameters. First, I am recursively iterating through a directory structure such as the following: C:/Users/programmer/Downloads/reviews/XBOX C:/Users/programmer/Downloads/reviews/PS3 C:/Users/programmer/Downloads/reviews/GBA Please notice the console game type at the end of the string...

java regular expression to search a block/string/word in a paragraph ...

Hi , i am new to java regular expression. Consider the follwoing paragraph : The Internet is a global system of interconnected computer networks that use the standardized Internet Protocol Suite (TCP/IP) to serve billions of users worldwide. It is a network of networks that consists of millions of private and public, academic, busines...

simple string transformation?

I have a website where I need to parse date/time strings from receipts. These can be in a variety of different formats -- for instance, one string could be '11/04/2009 12:46PM', while another could be 'Mar06'09 10:57AM'. I need to get a standard date/time string out of them to do a database insert. I'd like to avoid writing new php cod...

Javascript regexp question

I have a regexp which checks if a value has at least 10 digits: if (foo.match(/^\d{10,}$/)) { // At least 10 digits } However I want to divide the validation in 2 steps, so first i check if foo has got only numbers, and no other characters, and then i check if its got at least 10 digits. I can check the 10 digits part using foo.leng...

ASP.NET email validator regex

Does anyone know what the regex used by the email validator in ASP.NET is? Pretty please. ...

Error in converting string to float

Hi there, I have a rookie's question about the conversion. string Descript1 = ":1:2:3:4:5"; Regex pattern = new Regex("(:)"); foreach (string sub in pattern.Split(Descript1)) { if (sub != ":") { float a = Convert.ToSingle(sub); } } But this code keep pumping out the error: "the string was not in the correct format...

Validating a URL in PHP

I need a basic regular expression for validating a url, such that: Both http:// and http://www. are allowed (and the same thing with https:// and https://www.). All common tld like .com, .net. .org, .cc, .my, etc are allowed. Things like http://site.com/dir/dir2/page.html etc are allowed Only characters allowed in a url are allowed (su...

Regex: Does an XPATH string point to an attribute?

Here's what I'm using: ".+/@[^/]+$". Can you think of a reason why this might not work? ...