regex

FLEX: Is there a way to return mutiple tokens at once.

In flex, I want to return multiple tokens for one match of a regular expression. Is there a way to do this? ...

How can you extract all 6 letter Latin words to a list?

I need to have all 6 letter Latin words in a list. I would also like to have words which follow the pattern Xyzzyx in a list. I have used little Python. ...

html regex c#

I want to load an url as a string, and then use regex to write out matches in c#. ...

Regex error c#?

How i can use "/show_name=(.*?)&show_name_exact=true\">(.*?) Match m = Regex.Match(input, "/show_name=(.*?)&amp;show_name_exact=true\">(.*?)</i", RegexOptions.IgnoreCase); // Check Match instance if (m.Success) { // Get Group value string key = m.Groups[1].Value; Console.WriteLine(key); // ...

Any ideas why this does not work? C#

public class MyExample { public static void Main(String[] args) { string input = "<a href=\"http://tvrss.net/search/?show_name=The+Venture+Bros&amp;amp;show_name_exact=true\"&gt;The Venture Bros</a></p></li>"; // Call Regex.Match Match m = Regex.Match(input, "/show_name=(.*?)&amp;show_name_exact=true\">(.*?)</i"); ...

Java Regex - reduce spaces in a string

I dont have time to get my head around regex and I need a quick answer. Platform is Java I need the String "Some text   with spaces" to be converted to "Some text with spaces" e.g. 2 spaces to be change to 1 in a String ...

Regular Expression: Allow letters, numbers, and spaces (with at least one letter or number)

I'm currently using this regex ^[A-Z0-9 _]*$ to accept letters, numbers, spaces and underscores. I need to modify it to require at least one number or letter somewhere in the string. Any help would be appreciated! This would be for validating usernames for my website. I'd actually like to support as many characters as I can, but just wa...

How do I handle special characters in a Perl regex?

Hi, I'm using a Perl program to extract text from a file. I have an array of strings which I use as delimiters for the text, e.g: $pat = $arr[1] . '(.*?)' . $arr[2]; if( $src =~ /$pat/ ) { print $1; } However two of the strings in the array are '$450' and '(Buy now)'. The problem is that the symbols in the strings represent en...

Regex to read out HTML tags

I'm looking for a regex that matches all used HTML tags in a text consisting of several lines. It should read out "b", "p" and "script" in the following lines: <b> <p class="normalText"> <script type="text/javascript"> Is there such thing? The start I have is that it should start with a "<" and read until it hits a space or a ">", but...

C# Parsing a webpage's source

Among the wall of text that is a pages source; I need to get the video_id,l and t without the quotes so for a section like this. "video_id": "lUoiKMxSUCw", "l": 105, "sk": "-2fL6AANk__E49CRzF6_Q8F7yBPWdb9QR", "fmt_map": "35/640000/9/0/115,34/0/9/0/115,5/0/7/0/0", "t": "vjVQa1PpcFMbYtdhqxUip5Vtm856lwh7lXZ6lH6nZAg=", i need the following...

I only want to match the start tags in regex

I am making a regex expression in which I only want to match wrong tags like: <p> *some text here, some other tags may be here as well but no ending 'p' tag* </p> <P>Affectionately Inscribed </P><P>TO </P><P>HENRY BULLAR, </P><P>(of the western circuit)<P>PREFACE</P> In the above same text I want to get the result as <P>(of the west...

i want to match only start tags in regex

i am making a regex expression in which i want to only match wrong tags like <p> *some text here, some other tags may be here as well but no ending 'p' tag* </p> <P>Affectionately Inscribed </P><P>TO </P><P>HENRY BULLAR, </P><P>(of the western circuit)<P>PREFACE</P> like in the above same text i want to get the result as <P>(of th...

Difference between \A \Z and ^ $ in Ruby on Rails regular expressions

In the documentation I read: use \A and \Z to match the start and end of the string, ^ and $ match the start/end of a line I am going to apply a regular expression to check username (or e-mail is the same) submitted by user. Which expression should I use with validates_format_of in model? I can't understand the difference: I've alw...

Ruby expression

(?:) It is a valid ruby regular expression, could anyone tell me what it means? Thanks ...

What is the ultimate postal code and zip regex?

I'm looking for the ultimate postal code and zip code regex. I'm looking for something that will cover most (hopefully all) of the world. ...

How to remove a small part of the string in the big string using RegExp

Hey guys, I don't know RegExp yet. I know a lil about it but I'm not experience user. Supposed that I run a RegExp match on a website, the matches are: Data: Informations Data: Liberty Then I want to extract only Informations and Liberty, I don't want the Data: part. ...

JavaScript Regexp Replace?

I'm trying to come up with a regular expression which will wrap all occurences of JJDnnnnnnnnnnnnnnnn within a string with an anchor pointing to an url which contains the matched string in the query string. I suck at regexps :( ...

Javascript regex

I was trying to do a regex for someone else when I ran into this problem. The requirement was that the regex should return results from a set of strings that has, let's say, "apple" in it. For example, consider the following strings: "I have an apple" "You have two Apples" "I give you one more orange" The result set should have the fir...

php/dos : How do you parse a regedit export file?

My objective is to look for Company key-value in the registry hive and then pull the corresponding Guid and other keys and values following it. So I figured i would run the regedit export command and then parse the file with php for the keys I need. So after running the dos batch command >regedit /E "output.txt" "HKLM\System....\Co...

JavaScript Regexp to Wrap URLs and Emails in anchors

I searched high and low but cannot aeem to find a definitve answer to this. As is often the case with regexps. So I thought I'd ask here. I'm trying to put together a regular expression i can use in JavaScript to replace all instances of URLs and email addresses (does'nt need to be ever so strict) with anchor tags pointing to them. Obv...