tagged [regex]

Regular expression to catch letters beyond a-z

Regular expression to catch letters beyond a-z A normal regexp to allow letters only would be but I'm from, Sweden so I would have to change that into . But suppose I don't know what letters are used ...

3 Apr at 21:47

Regex to detect one of several strings

Regex to detect one of several strings I've got a list of email addresses belonging to several domains. I'd like a regex that will match addresses belonging to three specific domains (for this example...

3 Apr at 21:48

Regular Expression to split on spaces unless in quotes

Regular Expression to split on spaces unless in quotes I would like to use the .Net Regex.Split method to split this input string into an array. Input: Here is "my string"    it has "six  matches" Exp...

3 Apr at 21:49

Returning only part of match from Regular Expression

Returning only part of match from Regular Expression Say I have the string "User Name:firstname.surname" contained in a larger string how can I use a regular expression to just get the firstname.surna...

3 Apr at 22:8

Finding all *rendered* images in a HTML file

Finding all *rendered* images in a HTML file I need a way to find only IMG tags in a HTML snippet. So, I can't just regex the HTML snippet to find all IMG tags because I'd also get IMG tags that are s...

7 Apr at 13:40

How to extract a substring from a .NET RegEx?

How to extract a substring from a .NET RegEx? I have an XML file containing one (or more) key/value pairs. For each of these pairs I want to extract the value which is a two-byte hex value. So the XML...

10 Apr at 19:3

How do I use regex_replace from TR1?

How do I use regex_replace from TR1? I've not been able to get regex_replace from TR1 working. ``` #include #include #include int main() { std::string str = "Hello world"; std::tr1::regex rx("world");...

14 Apr at 15:8

Using C# regular expressions to remove HTML tags

Using C# regular expressions to remove HTML tags How do I use C# regular expression to replace/remove all HTML tags, including the angle brackets? Can someone please help me with the code?

25 Apr at 03:12

Are Java and C# regular expressions compatible?

Are Java and C# regular expressions compatible? Both languages claim to use Perl style regular expressions. If I have one language test a regular expression for validity, will it work in the other? Wh...

26 Apr at 16:58

return only Digits 0-9 from a String

return only Digits 0-9 from a String I need a regular expression that I can use in VBScript and .NET that will return only the numbers that are found in a string. For Example any of the following "str...

How to remove symbols from a string with Python?

How to remove symbols from a string with Python? I'm a beginner with both Python and RegEx, and I would like to know how to make a string that takes symbols and replaces them with spaces. Any help is ...

18 May at 01:55

Invert match with regexp

Invert match with regexp With PCRE, how can you construct an expression that will only match if a string is found. If I were using grep (which I'm not) I would want the -v option. A more concrete exa...

5 Jun at 18:46

Regular Expressions and negating a whole character group

Regular Expressions and negating a whole character group I'm attempting something which I feel should be fairly obvious to me but it's not. I'm trying to match a string which does NOT contain a specif...

10 Jun at 18:11

Poor man's "lexer" for C#

Poor man's "lexer" for C# I'm trying to write a very simple parser in C#. I need a lexer -- something that lets me associate regular expressions with tokens, so it reads in regexs and gives me back sy...

20 Jun at 01:23

How do you do case-insensitive string replacement using regular expressions?

How do you do case-insensitive string replacement using regular expressions? I know precisely zilch about regular expressions and figured this was as good an opportunity as any to learn at least the m...

16 Jul at 18:35

Is there a tool that enables me to insert one line of code into all functions and methods in a C++-source file?

Is there a tool that enables me to insert one line of code into all functions and methods in a C++-source file? It should turn this into this but for all (or at least a big bunch of) syntactically leg...

20 Jul at 13:57

Convert a char to upper case using regular expressions (EditPad Pro)

Convert a char to upper case using regular expressions (EditPad Pro) I wrote a regular expression in hope that I will be able to replace every match (that is just one char) to upper case char. I am us...

21 Jul at 14:30

I need a regex that validates for minimum 7 digits in the given string

I need a regex that validates for minimum 7 digits in the given string I wanna validate a phone number. My condition is that I want mimimum 7 numbers in the given string, ignoring separators, X, paran...

23 Jul at 04:57

How do I filter all HTML tags except a certain whitelist?

How do I filter all HTML tags except a certain whitelist? This is for .NET. IgnoreCase is set and MultiLine is NOT set. Usually I'm decent at regex, maybe I'm running low on caffeine... Users are allo...

23 Jul at 20:28

regex to match a single character that is anything but a space

regex to match a single character that is anything but a space I need to match a single character that is anything but a space but I don't know how to do that with regex.

25 Jul at 05:37

C#, regular expressions : how to parse comma-separated values, where some values might be quoted strings themselves containing commas

C#, regular expressions : how to parse comma-separated values, where some values might be quoted strings themselves containing commas In C#, using the `Regex` class, how does one parse comma-separated...

27 Jul at 17:11

How to pull the server name from a UNC

How to pull the server name from a UNC Would anyone be able to tell me how to pull the server name out of a UNC? ex. //servername/directory/directory Edit : I apologize but it looks like I need to cla...

14 Aug at 15:22

Regex PHP question

Regex PHP question Not gonna lie, I'm terrible at regex. How would I be able to do this guys: And pull out the "Data 1-23" from inside the above string using regex? And if I have multiple ones of this...

16 Aug at 22:30

C# How to delete XML/HTML comments with regular expression

C# How to delete XML/HTML comments with regular expression The fragment below doesn't work for me.

20 Aug at 05:4

Regular expression to check if a given password contains at least one number and one letter in c#?

Regular expression to check if a given password contains at least one number and one letter in c#? Can anyone help me write a regular expression for checking if a password has at least one letter and ...

22 Aug at 23:55