¡@

Home 

c# Programming Glossary: regex

Regular Expression to find a string included between two characters, while EXCLUDING the delimiters

http://stackoverflow.com/questions/1454913/regular-expression-to-find-a-string-included-between-two-characters-while-exclu

the brackets. Is it possible to do it Many thanks. c# regex share improve this question Easy done . Technically that's..

\d is less efficient than [0-9]

http://stackoverflow.com/questions/16621738/d-is-less-efficient-than-0-9

that out today and found out to my surprise that in the C# regex engine at least d appears to be less efficient than either of.. static TimeSpan testPerfomance List string strings string regex var sw new Stopwatch int successes 0 var rex new Regex regex.. var sw new Stopwatch int successes 0 var rex new Regex regex sw.Start foreach var str in strings if rex.Match str .Success..

How do I replace multiple spaces with a single space in C#?

http://stackoverflow.com/questions/206717/how-do-i-replace-multiple-spaces-with-a-single-space-in-c

one space in C# Example 1 2 3 4 5 would be 1 2 3 4 5 c# regex string share improve this question RegexOptions options RegexOptions.None.. question RegexOptions options RegexOptions.None Regex regex new Regex @ 2 options tempo regex.Replace tempo @ share improve..

Regex for numbers only

http://stackoverflow.com/questions/273141/regex-for-numbers-only

all so I'm having difficulty troubleshooting. I want the regex to match only when the contained string is all numbers but with.. with regular expressions. string compare 1234 4321 Regex regex new Regex @ d if regex.IsMatch compare true regex new Regex.. string compare 1234 4321 Regex regex new Regex @ d if regex.IsMatch compare true regex new Regex 0 9 if regex.IsMatch compare..

How can I strip HTML tags from a string in ASP.NET?

http://stackoverflow.com/questions/785715/how-can-i-strip-html-tags-from-a-string-in-asp-net

the HTML tags from a given string reliably i.e. not using regex I am looking for something like PHP's strip_tags . Example ul.. anything that meets my needs so far. c# asp.net html regex string share improve this question If it is just stripping.. all HTML tags from a string this works reliably with regex as well. Replace ^ with the empty string globally. Don't forget..

Using C# regular expressions to remove HTML tags [duplicate]

http://stackoverflow.com/questions/787932/using-c-sharp-regular-expressions-to-remove-html-tags

brackets Can someone please help me with the code c# html regex parsing share improve this question As often stated before..

Regex: Named Capturing Groups in .NET

http://stackoverflow.com/questions/906493/regex-named-capturing-groups-in-net

access the named capturing groups that are specified in my regex c# regex .net 2.0 share improve this question Use the group.. named capturing groups that are specified in my regex c# regex .net 2.0 share improve this question Use the group collection..

C# Reading a File Line By Line

http://stackoverflow.com/questions/1271225/c-sharp-reading-a-file-line-by-line

var file System.IO.File.OpenText datFile compile regexs Regex nameRegex new Regex IDENTIFY . while file.EndOfStream String.. System.IO.File.OpenText datFile compile regexs Regex nameRegex new Regex IDENTIFY . while file.EndOfStream String line file.ReadLine.. datFile compile regexs Regex nameRegex new Regex IDENTIFY . while file.EndOfStream String line file.ReadLine..

How to remove illegal characters from path and filenames?

http://stackoverflow.com/questions/146134/how-to-remove-illegal-characters-from-path-and-filenames

one. Edit Or a potentially 'better' solution using Regex's. string illegal M a ry h ad a li tt le la mb. string regexSearch.. new string Path.GetInvalidPathChars Regex r new Regex string.Format 0 Regex.Escape regexSearch illegal.. new string Path.GetInvalidPathChars Regex r new Regex string.Format 0 Regex.Escape regexSearch illegal r.Replace illegal..

\d is less efficient than [0-9]

http://stackoverflow.com/questions/16621738/d-is-less-efficient-than-0-9

using System.Text.RegularExpressions namespace SO_RegexPerformance class Program static void Main string args var.. regex var sw new Stopwatch int successes 0 var rex new Regex regex sw.Start foreach var str in strings if rex.Match str.. str .Success successes sw.Stop Console.Write Regex 0 12 took 1 result 2 3 regex sw.Elapsed successes strings.Count..

How do I replace multiple spaces with a single space in C#?

http://stackoverflow.com/questions/206717/how-do-i-replace-multiple-spaces-with-a-single-space-in-c

1 2 3 4 5 c# regex string share improve this question RegexOptions options RegexOptions.None Regex regex new Regex @ 2 options.. string share improve this question RegexOptions options RegexOptions.None Regex regex new Regex @ 2 options tempo regex.Replace.. this question RegexOptions options RegexOptions.None Regex regex new Regex @ 2 options tempo regex.Replace tempo @ share..

Regex for numbers only

http://stackoverflow.com/questions/273141/regex-for-numbers-only

for numbers only I haven't used regular expressions at all.. much with regular expressions. string compare 1234 4321 Regex regex new Regex @ d if regex.IsMatch compare true regex new.. expressions. string compare 1234 4321 Regex regex new Regex @ d if regex.IsMatch compare true regex new Regex 0 9 if regex.IsMatch..

URL Encoding using C#

http://stackoverflow.com/questions/575440/url-encoding-using-c-sharp

C# you simply use HttpUtility as mentioned. You can also Regex the illegal characters and then replace but this gets far more..

Reading PDF documents in .Net [closed]

http://stackoverflow.com/questions/83152/reading-pdf-documents-in-net

i 0 i patterns.Length i string regExPattern patterns i Regex regex new Regex regExPattern RegexOptions.IgnoreCase text regex.Replace.. i string regExPattern patterns i Regex regex new Regex regExPattern RegexOptions.IgnoreCase text regex.Replace text.. patterns i Regex regex new Regex regExPattern RegexOptions.IgnoreCase text regex.Replace text replace i return..

Regex: Named Capturing Groups in .NET

http://stackoverflow.com/questions/906493/regex-named-capturing-groups-in-net

Named Capturing Groups in .NET I'm having a hard time finding.. have so far string page Encoding.ASCII.GetString bytePage Regex qariRegex new Regex td a href link . name . a td MatchCollection.. string page Encoding.ASCII.GetString bytePage Regex qariRegex new Regex td a href link . name . a td MatchCollection mc qariRegex.Matches..

C#: Test if string is a guid without throwing exceptions?

http://stackoverflow.com/questions/104850/c-test-if-string-is-a-guid-without-throwing-exceptions

return false is not suitable. I would try using RegEx but since the guid can be parenthesis wrapped brace wrapped..

string.split - by multiple character delimiter

http://stackoverflow.com/questions/1254577/string-split-by-multiple-character-delimiter

rfd 5 . But I cannot seem to get it to work even if I try RegEx I cannot get a split on the delimiter. EDIT Essentially I wanted..

Regular Expression to find a string included between two characters, while EXCLUDING the delimiters

http://stackoverflow.com/questions/1454913/regular-expression-to-find-a-string-included-between-two-characters-while-exclu

the delimiters themselves. I'm trying to do it with C# RegEx object. A simple example should be helpful Target extract the..

RegEx C# : Find a string between 2 known values

http://stackoverflow.com/questions/1717611/regex-c-sharp-find-a-string-between-2-known-values

C# Find a string between 2 known values I need to be able to.. .NET 3.5. c# .net regex share improve this question A RegEx free solution string ExtractString string s string tag You should..

glob pattern matching in .NET

http://stackoverflow.com/questions/188892/glob-pattern-matching-in-net

for a end user facing control. I fear that permitting all RegEx capabilities will be very confusing. c# .net glob share improve..

Add spaces before Capital Letters

http://stackoverflow.com/questions/272633/add-spaces-before-capital-letters

Spaces But It Does Have Capitals Here is my attempt with a RegEx System.Text.RegularExpressions.Regex.Replace value A Z 0 c#..

RegEx matching HTML tags and extracting text

http://stackoverflow.com/questions/299942/regex-matching-html-tags-and-extracting-text

matching HTML tags and extracting text I have a string of test.. of test like this customtag hey customtag I want to use a RegEx to modify the text between the customtag tags so that it might.. to modify the text but I'm unsure of the proper RegEx syntax to use. Any help would be much appreciated. c# regex..

Regular expression to remove HTML tags

http://stackoverflow.com/questions/3790681/regular-expression-to-remove-html-tags

syntax at all and fumbled through this. Can someone with RegEx knowledge please provide me with a pattern that will work. Here..

C#'s edge over VB [closed]

http://stackoverflow.com/questions/380274/cs-edge-over-vb

Where is a good Address Parser [closed]

http://stackoverflow.com/questions/518210/where-is-a-good-address-parser

AZ addr.PostalCode 86011 Now I could do this using RegEx. But the tricky part is keeping it general enough to handle..

How would you count occurrences of a string within a string?

http://stackoverflow.com/questions/541954/how-would-you-count-occurrences-of-a-string-within-a-string

like it at all any takers I don't really want to dig out RegEx for this do I EDIT I I know my string is going to have the term..

Using C# regular expressions to remove HTML tags [duplicate]

http://stackoverflow.com/questions/787932/using-c-sharp-regular-expressions-to-remove-html-tags

tags duplicate This question already has an answer here RegEx match open tags except XHTML self contained tags 36 answers..

Using RegEx to balance match parenthesis

http://stackoverflow.com/questions/7898310/using-regex-to-balance-match-parenthesis

RegEx to balance match parenthesis I am trying to create a .NET RegEx.. to balance match parenthesis I am trying to create a .NET RegEx expression that will properly balance out my parenthesis. I.. properly balance out my parenthesis. I have the following RegEx expression func a zA Z_ a zA Z0 9_ . The string I am trying..

Implementing RegEx Timeout in .NET 4

http://stackoverflow.com/questions/9460661/implementing-regex-timeout-in-net-4

RegEx Timeout in .NET 4 Platform Silverlight 4 .NET 4 With the .NET.. 4 .NET 4 With the .NET 4.5 Developer preview the RegEx class has been enhanced to allow setting of a Timeout value.. allow setting of a Timeout value which would prevent the RegEx engine from hanging the UI if there are issues with the pattern..