Regular Expressions - .NET Development
Recent update: 2008-3-21

search words sequence in a string with regular expression

810 byte By Abunet at 2008-3-7
HI,I've got some strings that contain the following text:1) "That film is very beautifull".2) "How much beautifull is the film?".3) "The film is boring".I need, if it is possible with RegEx, to search if the string contains "film" AND ...

Regex on Non-US Address

974 byte By Jae at 2008-3-6
Hi,If I had a textbox that contained the following:--Mr FirstName LastNameABCD Ltd, Address 1, Address 2, Town/City, PostCode,Notes1, Tel: 0171 800900, Fax: 0171 800909--how can I parse this to --Mr, FirstName, LastName, ABCD Ltd, Address 1, Address 2, Town/City, PostCode, Notes1, 0171 800900, ...

regular expression pattern

500 byte By PradeepGupta at 2008-3-5
4/21/2003 : On 4/21/2003 6:02:49 PM By DBROWN :: ; 
 On 4/21/2003 7:04:41 PM By DBROWN :: 
 called on 4/19 ; from the above string can any one tell me the pattern toextract the date preceded by 'On ' and name preceded by ...

regex match search or not to search

1823 byte By software_writer_nyc at 2008-3-3
Re: System.Text.RegularExpressions.Regex, C#lets call the string to be searched target stringDesired Result: Efficiently Match a regular expression to target string. WHOLE target string should be consumed.Actual Result: The Match searches as documented until it finds a match WITHIN the target ...

StreamReader, Regex and memory

1812 byte By AndreasAsterlund at 2008-3-1
I am using StreamReader's method ReadToEnd() to read an entire file in to a String. I then use a Regex to parse some content from the file. I do this two times for each file to get all the data i want from it. The first regular expression looks like this:String^ regexData1 = ...

regex help

526 byte By sakarmo at 2008-2-28
I am trying to this regex but I am not. is it possible? help me!!!!string: x*[2+[(2+y)*z]*(4+y)]-3/[(3+y)*z] regex: ? matches: 2+[(2+y)*z]*(4+y) (3+y)*z (Moderator: Thread moved to the Regular Expression Forum and Title tweaked for quicker thread understanding during a search) ...

Matching using multiple question marks

526 byte By sakarmo at 2008-2-27
I am trying to this regex but I am not. is it possible? help me!!!!string: x*[2+[(2+y)*z]*(4+y)]-3/[(3+y)*z] regex: ? matches: 2+[(2+y)*z]*(4+y) (3+y)*z (Moderator: Thread moved to the Regular Expression Forum and Title tweaked for quicker thread understanding during a search) ...

How can I make multiple regex check with string values?

973 byte By Jil at 2008-2-26
I am using VS 2003 and Regex.I wanted to spilt the text from richtextbox if it matches newlines or semicolon or "/" or "\n\x20*\n" etc few sequences.If any of these matches, I need a splitFor single sequences, I use thisRegex* regxterm = __gc new ...

Parsing double value from a string

779 byte By TheMadMonk at 2008-2-25
Hi all,I need to parse a string which is in the following format (example): -0.0004 USD/TonnesBasically, it will be a double value, might be preceded by the negative (-) sign and followed by <Currency>/<Unit of Measure> .The result should be just the double value (with the sign if ...

RegEx MatchEvaluator, how to write a oneliner?

1901 byte By BerndWechner at 2008-2-24
I'm working off the help here for examples and struggliong to understand how I can convert it's multiline example into a oneliner. I'm more used to Perl ;-).Here's some code fro example that works:string First3(Match M) { return M.Value.Remove(3); } // defined in the class MyClassMyClass C ...

regex

476 byte By zybernau at 2008-2-23
can anyone explain about regular expressionsthe complex patterns that are shown in the previous threads are hard to follow. i need some more explaination how to give a pattern..Thanks in advance..(Moderator: Thread moved to the Regular Expression Forum and Title tweaked for better ...

regex - Pattern Help For Beginner

476 byte By zybernau at 2008-2-22
can anyone explain about regular expressionsthe complex patterns that are shown in the previous threads are hard to follow. i need some more explaination how to give a pattern..Thanks in advance..(Moderator: Thread moved to the Regular Expression Forum and Title tweaked for better ...

To Learn RegEx

465 byte By NETPR at 2008-2-22
Hello,I will be working with text from files and manipulated them. Thus, I need to learn about RegEx. I know the HELP in visual studio has it and it even has examples, but those examples are not explained....all I see is a bunch of symbols that work together to get their results....They do not ...

Using Regex/Match to find decimal Index location from RightToLeft.

951 byte By rayfusion at 2008-2-21
I am trying to find the decimal index location from RightToLeft using Regex/Match. When the code below runs, I keep getting the index value from LeftToRight even though I specified RegexOptions.RightToLeft. What am I missing here?Regex r = new ...

string generation using regex (regular expression)

308 byte By neocon at 2008-2-20
i have to generate a string based upon a regular expression provided as input. There is a System.Text.RegularExpressions.Regex class in .net but i could not find any API to generate string using a Regex object. Can any suggest how can i generate a string using regular expression in C#? ...

Help: A dumb,trivial Regex question?

972 byte By NedHamilton at 2008-2-20
I'm having a problem understanding how Regex.Match interprets an extremely trivial match problem.If I'm searching the string "ban" with the pattern b*, the matched string is b as one would expect. But if I change the pattern to a*, there is no match.Now I would have thought that since .NET ...

A specialized String.Split but on a location instead of a character

976 byte By OmegaMan at 2008-2-20
I am looking to split a string at a specific character count and return an array of strings from that, with the smarts ofnot splitting on a word....The functionality would somewhat mirror string.Split which is used to tokenize, but instead of a character it would have a hard minimum line size. ...

Regular Expression: Help on creating appropriate expression needed...

974 byte By renemt at 2008-2-19
Hi there!I'm now trying since hours to construct an appropriate regex that will fit my needs. Here is the starting situation:I've got a string like"abc F123[F456[F789]] 123"In this string I want to find the following expressions:- F123[F456[F789]]- F456[F789]- F789An expression is defined as ...

RegEx and URL's

753 byte By AndrewVos at 2008-2-18
I need a regex pattern that can be used to extract urls from the clipboard. Clipboard data could be text, html or rtf even.Possibly three different patterns?Any ideas?Anyone done this sort of thing before?There are so many problems of course, for example invalid characters in url, url cant ...

To regex - or not to regex?

679 byte By Martinp23 at 2008-2-17
Hi,I have yet another regex query - this time regarding the retieval of a URL from HTML. I have a string called HTML, with a number of links on it. The format for these links is something like:<a href="/index/welcome.php?action=one&amp;section=27">one</a>Now, I only ...

Validatiom email

109 byte By LeandroRodrigues at 2008-2-16
Someone know where hava a example og validation of email. <font face=Verdana>Thank you! </font>

Regex Question

550 byte By WeeBubba at 2008-2-15
i have a dynamic string, for example "([1] * [5]) / 100"what I want to do is find all the matches of strings hed within the square brackets. for each instance i want to tun some logic and do a replace. e.g. in the above example [1] i would be replacing with [Joe Bloggs] after doing a lookup on ...

Match groups and subgroups in a string

550 byte By WeeBubba at 2008-2-15
i have a dynamic string, for example "([1] * [5]) / 100"what I want to do is find all the matches of strings hed within the square brackets. for each instance i want to tun some logic and do a replace. e.g. in the above example [1] i would be replacing with [Joe Bloggs] after doing a lookup on ...

Help on regex

377 byte By GoDaddy at 2008-2-15
I need a regex for a timespan .. from 15 min to 24 hour. input is something like 00:15I'm not very good in building the pattern. Thanks, (Moderator: Thread move to Regular Expression forum and Title changed from "Help on regex" to "Regex and Timespan" for quicker thread understanding during a ...

Regex and Timespan

377 byte By GoDaddy at 2008-2-15
I need a regex for a timespan .. from 15 min to 24 hour. input is something like 00:15I'm not very good in building the pattern. Thanks, (Moderator: Thread move to Regular Expression forum and Title changed from "Help on regex" to "Regex and Timespan" for quicker thread understanding during a ...

Problem with RegEx

536 byte By hglenni at 2008-2-15
I have an issue with RegEx. Here is an example of what I am doing and what I am expecting and what I get.Text:Glenn InmanExpression:(?<!(?i:\bhoward\b))\s+(?i:\bglenn\b).* Code:bool bMatch = RegEx.IsMatch("Glenn Inman", "(?<!(?i:\bhoward\b))\s+(?i:\bglenn\b).*")Returns falseexpect ...

Regex get last number in string

269 byte By zubziro at 2008-2-14
Hi ! Can someone plz help me to extract last number in strings using Regex ? here some examples: 1: "ksdhfkjsdhf 12" 2: "sdfsd fd sdfsdf 333" 3: "jgjhhhjdfg15" the result should be: 12 333 15 Thanks !!!

Dual MatchCollection on "A B|C D|E F|G H" input

749 byte By NewGuy212 at 2008-2-14
I have an input file (this is simplified; the real input file is very very very large):A 1\nB 2\nC 3\nD 4\nI am using the following code: Regex first_part = new Regex("[A-Z]* "); Regex second_part = new Regex("[A-Z]*\r\n"); MatchCollection firsts = first_part.Matches(input_file); ...

Regex errors

521 byte By ChrisAus at 2008-2-13
Hi,I'm trying to split a string that holds the full path to a directory using Regex(i.e Regex *regex = new Regex(S"\\");, however I keep getting the following error : parsing "\" - Illegal at end of patternParameter name: \.Is there any other way to split up the directories, or to fix this ...

Regex errors parsing file path

521 byte By ChrisAus at 2008-2-13
Hi,I'm trying to split a string that holds the full path to a directory using Regex(i.e Regex *regex = new Regex(S"\\");, however I keep getting the following error : parsing "\" - Illegal at end of patternParameter name: \.Is there any other way to split up the directories, or to fix this ...

C# Regular Expressions confusion

686 byte By Paradox22 at 2008-2-12
Hi everyone,I'm writing a client for the Cyan Chat protocol ( http://cho.cyan.com/chat) and all of the usernames are sent to the client as:X[username]|^1TextThe X prefixing the username is a colour code. Currently I can print out what users say in my richTextBox, but I need a regular expression ...

Escaping decimal points in regular expressions

713 byte By GailG at 2008-2-11
I'm trying to do something that ought to be very simple. I'm trying to test whether a string (which is an argument to a command) is a valid value of the type I need.That is, I want it to be convertable to a double and be in the range 0.1-1.0.I have this line in my code:Regex ValidPause = new ...

help with string match regex

1352 byte By Ultrawhack at 2008-2-10
With ref to Egyptian's code http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=570980&SiteID=1to find paras in a string and split each para and populate datagridview1 col1, row1 with para1... col1, row2 with para2 etc...I am unable to translate this to c# and request help esp with the ...

Doing the match in C# from VB code

1352 byte By Ultrawhack at 2008-2-10
With ref to Egyptian's code http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=570980&SiteID=1to find paras in a string and split each para and populate datagridview1 col1, row1 with para1... col1, row2 with para2 etc...I am unable to translate this to c# and request help esp with the ...

Questions about Regular Expressions

1123 byte By Sheng1983 at 2008-2-8
Hi, could anyone tell me how I could make some changes to make the following code be able to return true when strURL=" http://mm77/creator" please? It's urgent! Thanks in advance!!public static Boolean isURLValid(String strURL){ Boolean blnResultURL = false;if ...

Help in regular expression

211 byte By Maaloul at 2008-2-8
Hello, can someone help me in providing a regular expression who 'se adequter with a string who have a min required length 6 characters . in these caracters 2 , minmum, are none alphanumerical characters thanks

Create Validation Regular Expression

301 byte By WebSigMan at 2008-2-7
Hello! I want to ask a simple question about regular expression in asp.net.the question is how to handle "javascript" as a single word by creating a validation expression for regular expression server control.Please, I need the answer as soon as ...

regular expression

328 byte By SyedRahmanMashwani at 2008-2-7
Regex regex = new Regex( "^\d+$");this code gives an error pointing \d .error message is "invalid escape character" , but in fact \d is not escap character , \d means 0 to 9 digits.how can i fix this ...

How to convert string to expression

246 byte By MuraliSalem at 2008-2-7
I am having an string "3<2", I would like to use it in a if statement as if(3<2). How to convert this string into an boolean expression. Can we convert a string like "a<b" into a boolean expression.

Explain Match Behavior

964 byte By NedHamilton at 2008-2-7
I'm having a problem understanding how Regex.Match interprets an extremely trivial match problem.If I'm searching the string "ban" with the pattern b*, the matched string is b as one would expect. But if I change the pattern to a*, there is no match.Now I would have thought that since .NET ...

Regex expression help

800 byte By goh6613 at 2008-2-6
hi all.....i try to mod ify my .ini file using regex function......and this is my code Dim checkpassword As String = Regex.Replace(Regex.Replace(line, "^USER=goh.dev.ss.lan", ""), "Password=", "Password=123") sw.WriteLine(checkpassword) sw.Close()this will replace all the matched ...

Match only the first line during replace

800 byte By goh6613 at 2008-2-6
hi all.....i try to mod ify my .ini file using regex function......and this is my code Dim checkpassword As String = Regex.Replace(Regex.Replace(line, "^USER=goh.dev.ss.lan", ""), "Password=", "Password=123") sw.WriteLine(checkpassword) sw.Close()this will replace all the matched ...

Is there a better way of coding this RegEx ?

1622 byte By Rhubarb at 2008-2-5
I need to run verification on SSN's read from a file sent to us by our users. We cannot process any records that with an SSN that has all zeroes, ones, twos, threes, ... etc.I have completed the below RegEx that catches all invalid SSN's up to a point and then began wondering if another way ...

Is there a better way of coding this SSN RegEx ?

1622 byte By Rhubarb at 2008-2-5
I need to run verification on SSN's read from a file sent to us by our users. We cannot process any records that with an SSN that has all zeroes, ones, twos, threes, ... etc.I have completed the below RegEx that catches all invalid SSN's up to a point and then began wondering if another way ...

Better way of removing commas

3081 byte By OmegaMan at 2008-2-4
Here is the situation, using C# and VS2005, one has a string that contains a number. Unfortunatley the originator of the string is ouputing commas within the string such as"1,234,567.89"What is the best way to strip commas from a string?Below is a method I have come up with that seems ...

Declare Regex in ECMA style syntax

406 byte By KellyB at 2008-2-4
I would just like to post a request. In a future version of the C# language (possibly 3.0) It would be very nice to be able to create a Regex in the ECMAScript style syntax.So instead of:Regex myRx = new Regex("\\d+\\.\\d{2}");We could use:Regex myRx = /\d+\.\d{2}/;Since Regex features are ...

Slow regexp for first time match

580 byte By Fran?ois-RgisColin at 2008-2-4
hello,I have an apllication that have about 3000 regexp compiled using the formregexp = new Regex(expression, RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);when a try to match a string against the 3000 regexp for the first time it take about 2 minutes on a Big ...

Slow regexp for first time match

586 byte By Fran?ois-RgisColin at 2008-2-4
hello, I have an apllication that have about 3000 regexp compiled using the form regexp = new Regex(expression, RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.CultureInvariant); when a try to match a string against the 3000 regexp for the first time it take about 2 minutes on a ...

Regex question (lazy quantifier)

1707 byte By AlexanderProkofyev at 2008-2-3
Hi, I have a HTML file which contains a lot of lines in form <tr><td nowrap="0">First cell text</td><td nowrap="0">Second cell text -</td></tr> and I need to extract text from cells in second column (take note of a dash at the end of ...

Regex for 23:46

371 byte By bilalso at 2008-2-3
Hi, I need to check if a string in a certain format using Regular Expression. I want to check if the string is 23:46 format. where 23 can be any 2-digit integer and 46 can be any 2-digit integer as well..and the two integers are separated by a colon character : How can I write it in a regular ...

.NET Development

Site Classified