regex

How to shave off last character using sed?

That is, going from ABCD -> ABC ...

Getting result using patters

Hi, I have a String looks like this String read = "1130:5813|1293:5803|1300:5755|1187:5731|" As you can see that there are 4 pair of integer values are there. i want to add there values into the list something like this a = 1130 b = 5813 groupIt pair = new groupIt(a,b); List<groupIt> group = new ArrayList<groupIt>(); group.add(...

Regex, match string 4 or 5 digits long between "\" and "\"

I need to build a regex. the string i want to match always starts with \ then 4 or 5 numbers then another \ For example. Welcome Home<\217.163.24.49\7778\False, Euro Server\217.163.26.20\7778\False, Instagib!)\85.236.100.115\8278\False, in first example i need "7778". In second example i need "7778". In third example i need "8278". ...

What's the Regular Expression that matches culture names?

I'd like to use a regular expression to filter culture names (like en-US or pt-BR). Anyone has any idea? ...

Question regarding regex and tokenizing

I need to make a tokenizer that is able to English words. Currently, I'm stuck with characters where they can be part of of a url expression. For instance, if the characters ':','?','=' are part of a url, i shouldn't really segment them. My qns is, can this be expressed in regex? I have the regex \b(?:(?:https?|ftp|file)://|www\.|ft...

How to ignore regex matches in C#?

An input string: string datar = "aag, afg, agg, arg"; I am trying to get matches: "aag" and "arg", but following won't work: string regr = "a[a-z&&[^fg]]g"; string regr = "a[a-z[^fg]]g"; What is the correct way of ignoring regex matches in C#? ...

Regex split into array of pieces

I was wondering how could I split this string {{MENU}}<li><a href="{{LINK}}" title="{{TITLE}}"><span>{{TITLE}}</span></a></li>{{/MENU}} Into array of: array( "<li><a href=\"", "{{LINK}}", "\" title=\"", "{{TITLE}}", "\"><span>", "{{TITLE}}", "</span></a></li>" ) It also should work with more differen...

Regex for anything between []

Hi, I need to find the regex for [] For eg, if the string is - Hi [Stack], Here is my [Tag] which i need to [Find]. It should return Stack, Tag, Find ...

How to check the arguments with Regex?

I'm stuck with regular expressions. The program is a console application written in C#. There are a few commands. I want to check the arguments are right first. I thought it'll be easy with Regex but couldn't do that: var strArgs = ""; foreach (var x in args) { strArgs += x + " "; } if (!Regex.IsMatch(strArgs, @"(-\?|-help|-c|-cont...

Regular expression for counting sentences in a block of text.

Possible Duplicate: PHP - How to split a paragraph into sentences. I have a block of text that I would like to separate into sentences, what would be the best way of doing this? I thought of looking for '.','!','?' characters, but I realized there were some problems with this, such as when people use acronyms, or end a sentenc...

Find where and which word matched sql LIKE statement

I am using a very long like query to detect offensive words within my users usernames. I have made a moderator page where the moderator can click a button next to the detected username and it will replace the offending word with *'s. The problem is how can I easily detect which offensive word and where to replace? I guess I would need...

Regex for space, but not escaped spaces.

I am parsing the input of ls -lb and trying to put each field into an array in PHP. My input looks something like this: -rwx------ 1 user.name users 546879 2008-09-05 09:23 Newspaper_Templates.pdf -rwx------ 1 user.name users 403968 2009-01-12 14:16 P2_05.ppt -rwx------ 1 user.name users 144896 2009-01-12 14:08 P2.5_Using_CRO...

Ruby: How can I read a regex from a file, then parse strings using that regex?

This is one of the most difficult things to search for because when you search how to parse a regex you get how to parse with a regex. I want to read a regex from a file, put it in an object somehow, then parse strings using that regex in my program. Im sure someone has done this before, can you help me out on where to start? ...

C# regex need characters after \player_n\

I need a regex pattern which will accommodate for the following. I get a response from a UDP server, it's a very long string and each word is separated by \, for example: \g79g97\g879o\wot87gord\player_0\name0\g6868o\g78og89\g79g79\player_1\name1\gyuvui\yivyil\player_2\name2\g7g87\g67og9o\v78v9i7 I need the strings after \player_n\, ...

open source license scanner (heuristic, regular expression matches in subdirs)

Assume you have a small collection of WebCMS assembled, subdirs in ~/www/test/ or so. And now you want to quickly/crude scan and detect the license in each project. Is there a simple grep/perl/regex scanner which can guess the used licenses? Doesn't need to be exact or reliable, just for getting a rough overview, and just needs to inspe...

using Regular Expressions and tags to extract portion of text

So I have a text file that is having special tags like: {A1} Text 1 {A1} {A2} Text 2 {A2} How can I extract from the text using reg-ex the portion Text 2 or Text 1 ..? So I what to be able to extract only what is between tags A1 or only what is between Tags A2 .. not all of them ... at once! thanks! ...

c# regular expression to match img src="*" type URLs.

I have a regex in c# that i'm using to match image tags and pull out the URL. My code is working in most situations. The code below will "fix" all relative image URLs to Absolute URLs. The issue is that the regex will not match the following: <img height="150" width="202" alt="" src="../Image%20Files/Koala.jpg" style="border: 0px solid...

Regular Expression for all positive even numbers

I am currently enrolled in Translation Applications and we are working on regular expressions. This IS a homework problem. I have been at this one for a while I am just confused. I don't want just an answer, an explanation would be greatly appreciated just making sure that I learn it. I just need a regular expression for all even number...

Regex help: positive decimal, 2 places

Hi I'm struggling with a regex problem. The requirement is for decimals to 2 places, non zero and not negative. Its the non-zero thats getting me. Anything such as 0.01, 0.99, 99999999.99 is allowed However negative numbers and also 0, 0.0 or 0.00 is not allowed... I thought I was getting somewhere but this is wrong ^(?!(0)|(0\.0)...

How do you create an array to store regex string matches in java?

I'm trying to take a file that store data of this form: Name=”Biscuit” LatinName=”Retrieverus Aurum” ImageFilename=”Biscuit.png” DNA=”ITAYATYITITIAAYI” and read it with a regex to locate the useful information; namely, the fields and their contents. I have created the regex already, but I can only seem to get one match at any give...