tagged [regex]

How do you retrieve selected text using Regex in C#?

How do you retrieve selected text using Regex in C#? How do you retrieve selected text using Regex in C#? I am looking for C# code that is equivalent to this Perl code:

25 Oct at 10:13

SQL Server Regular expressions in T-SQL

SQL Server Regular expressions in T-SQL Is there any regular expression library written in T-SQL (no CLR, no extended `SP`, pure T-SQL) for SQL Server, and that should work with shared hosting? Edit: ...

20 Nov at 18:37

Regex - how to match everything except a particular pattern

Regex - how to match everything except a particular pattern How do I write a regex to match any string that doesn't meet a particular pattern? I'm faced with a situation where I have to match an (A an...

30 Jul at 02:52

Replace first occurrence of string in Python

Replace first occurrence of string in Python I have some sample string. How can I replace first occurrence of this string in a longer string with empty string?

3 Dec at 03:59

JS regex: replace all digits in string

JS regex: replace all digits in string I need to replace all digits. My function only replaces the first digit.

4 Jul at 11:37

Regular Expression with wildcards to match any character

Regular Expression with wildcards to match any character I am new to regex and I am trying to come up with something that will match a text like below: ABC: (z) jan 02 1999 \n Notes: - - - - - - Any h...

5 Oct at 22:33

Regular expression to match balanced parentheses

Regular expression to match balanced parentheses I need a regular expression to select all the text between two outer brackets. Example: `START_TEXT(text here(possible text)text(possible text(more tex...

19 Apr at 12:33

Regex ignore middle part of capture

Regex ignore middle part of capture I want a single regex that when applied to : "firstsecondthird" will match "firstthird" (in single group, ie in C# `Match.Value` will be equal to "firstthird"). Is ...

14 Oct at 13:56

Regular Expression for alphabets with spaces

Regular Expression for alphabets with spaces I need help with regular expression. I need a expression which allows only alphabets with space for ex. college name. I am using : but it's not working.

15 Feb at 08:24

Regular expression to allow backslash in C#

Regular expression to allow backslash in C# Can anyone provide me with regex for validating string which only should not allow any special characters except backslash. I tried But it doesn't seem to ...

1 Feb at 07:5

Allow only alphanumeric in textbox

Allow only alphanumeric in textbox I have a textbox that should disallow entering any special characters. The user can enter : 1. A-Z 2. a-z 3. 0-9 4. Space How can I make the `KeyDown` event to do t...

6 Apr at 15:36

How to validate numeric values which may contain dots or commas?

How to validate numeric values which may contain dots or commas? I need a regular expression for validation `two or one` numbers then `,` or `.` and again `two or one` numbers. So, these are valid inp...

25 Sep at 03:28

Difference between \w and \b regular expression meta characters

Difference between \w and \b regular expression meta characters Can anyone explain the difference between `\b` and `\w` regular expression metacharacters? It is my understanding that both these metach...

13 Nov at 13:0

Django url pattern - string parameter

Django url pattern - string parameter Django url pattern that have a number parameter is: What will be the correct syntax if my poll_id is not a number but a string of character?

10 Aug at 03:4

Regex: C# extract text within double quotes

Regex: C# extract text within double quotes I want to extract only those words within double quotes. So, if the content is: > Would "you" like to have responses to your "questions" sent to you via ema...

23 Oct at 05:27

Find the location of a character in string

Find the location of a character in string I would like to find the location of a character in a string. Say: `string = "the2quickbrownfoxeswere2tired"` I would like the function to return `4` and `24...

18 Jul at 08:28

Why am I getting "The name Regex does not exist in the current context" from my C# code?

Why am I getting "The name Regex does not exist in the current context" from my C# code? Why am I getting this error: > The name Regex does not exist in the current context. from my code?

4 Oct at 00:52

Check if string contains only letters in javascript

Check if string contains only letters in javascript So I tried this: It doesn't accept this : `" "` But it does accept this: `"word word"`, which does contain a space :/ Is there a good way to do this...

5 May at 15:47

Visual Studio Code Search and Replace with Regular Expressions

Visual Studio Code Search and Replace with Regular Expressions I want to use "Search And Replace" in Visual Studio Code to change every instance of `content` to `#### content` within a document using ...

8 Aug at 11:17

How to write regular expression to match only numbers, letters and dashes?

How to write regular expression to match only numbers, letters and dashes? I need an expression that will only accept: - - - Spaces are not allowed either. Example: The regular expression should matc...

9 Sep at 19:38

Java RegEx meta character (.) and ordinary dot?

Java RegEx meta character (.) and ordinary dot? In Java RegEx, how to find out the difference between `.`(dot) the meta character and the normal dot as we using in any sentence. How to handle this kin...

6 Jul at 13:3

How to extract numbers from a string in Python?

How to extract numbers from a string in Python? I would like to extract all the numbers contained in a string. Which is better suited for the purpose, regular expressions or the `isdigit()` method? Ex...

17 Jun at 06:30

RegEx to replace special characters in a string with space ? asp.net c#

RegEx to replace special characters in a string with space ? asp.net c#

18 May at 18:27

Get first numbers from String

Get first numbers from String How to get the first numbers from a string? Example: I have "1567438absdg345" I only want to get "1567438" without "absdg345", I want it to be dynamic, get the first occu...

12 Dec at 14:49

Regex number between 1 and 100

Regex number between 1 and 100 I searched a lot and can't find the solution for this RegExp (I have to say I'm not very experienced in Reg. Expressions). I would like to test a number

19 Mar at 11:20