Click here to Skip to main content
15,867,330 members
Home / Discussions / Regular Expressions
   

Regular Expressions

 
QuestionRegular expression to check special character Pin
sri_34648-Sep-11 11:16
sri_34648-Sep-11 11:16 
AnswerRe: Regular expression to check special character Pin
Mizard X25-Sep-11 0:06
Mizard X25-Sep-11 0:06 
QuestionHelp with pattern Pin
Phrone7-Sep-11 20:25
Phrone7-Sep-11 20:25 
AnswerRe: Help with pattern Pin
thatraja28-Nov-11 19:10
professionalthatraja28-Nov-11 19:10 
QuestionWhat is the Regular expression that detects a $ sign and digits in html code Pin
Member 82168286-Sep-11 7:49
Member 82168286-Sep-11 7:49 
AnswerRe: What is the Regular expression that detects a $ sign and digits in html code [modified] Pin
Paladin20006-Sep-11 10:54
Paladin20006-Sep-11 10:54 
GeneralRe: What is the Regular expression that detects a $ sign and digits in html code Pin
Member 82168287-Sep-11 5:20
Member 82168287-Sep-11 5:20 
GeneralRe: What is the Regular expression that detects a $ sign and digits in html code Pin
Paladin20007-Sep-11 5:27
Paladin20007-Sep-11 5:27 
It does work. Try this in a console app:

C#
static void Main(string[] args)
{
    Regex rx = new Regex(@"\$(\d{1,3}(,\d{3})*)(\.\d\d)?");
    foreach (Match m in rx.Matches("This matches $4.12 dollars.  It also matches $32.32 or $15 or $2.11 or $0.12 or $156,789.33 or $12,345.67"))
    {
        Console.WriteLine(m.Value);
    }
    Console.ReadKey();
}


Output:

$4.12
$32.32
$15
$2.11
$0.12
$156,789.33
$12,345.67


Of course, you must reference the System.Text.RegularExpressions namespace. Also, here is a page you can use to help learn regular expression syntax:

http://www.regular-expressions.info/reference.html
GeneralRe: What is the Regular expression that detects a $ sign and digits in html code Pin
Member 82168287-Sep-11 8:48
Member 82168287-Sep-11 8:48 
GeneralRe: What is the Regular expression that detects a $ sign and digits in html code Pin
Pete O'Hanlon7-Sep-11 5:38
subeditorPete O'Hanlon7-Sep-11 5:38 
AnswerRe: What is the Regular expression that detects a $ sign and digits in html code Pin
jschell7-Sep-11 8:32
jschell7-Sep-11 8:32 
QuestionRegular Expression Pin
Morgs Morgan11-Jul-11 22:07
Morgs Morgan11-Jul-11 22:07 
AnswerRe: Regular Expression Pin
Firo Atrum Ventus11-Jul-11 22:31
Firo Atrum Ventus11-Jul-11 22:31 
GeneralRe: Regular Expression Pin
Morgs Morgan11-Jul-11 23:09
Morgs Morgan11-Jul-11 23:09 
GeneralRe: Regular Expression Pin
PIEBALDconsult17-Jul-11 5:55
mvePIEBALDconsult17-Jul-11 5:55 
AnswerRe: Regular Expression [modified] Pin
PIEBALDconsult17-Jul-11 7:02
mvePIEBALDconsult17-Jul-11 7:02 
AnswerRe: Regular Expression Pin
JimmyRopes13-Aug-11 11:57
professionalJimmyRopes13-Aug-11 11:57 
AnswerRe: Regular Expression [modified] Pin
Shahan Ayyub23-Aug-11 11:00
Shahan Ayyub23-Aug-11 11:00 
QuestionValue between brackets with a sperator character [modified] Pin
Groulien26-May-11 2:27
Groulien26-May-11 2:27 
AnswerRe: Value between brackets with a sperator character Pin
Groulien26-May-11 3:28
Groulien26-May-11 3:28 
AnswerRe: Value between brackets with a sperator character Pin
Peter_in_278026-May-11 14:13
professionalPeter_in_278026-May-11 14:13 
Questionarray of file extentions Pin
Ali Al Omairi(Abu AlHassan)22-May-11 20:43
professionalAli Al Omairi(Abu AlHassan)22-May-11 20:43 
AnswerRe: array of file extentions Pin
Peter_in_278022-May-11 21:13
professionalPeter_in_278022-May-11 21:13 
GeneralRe: array of file extentions Pin
Ali Al Omairi(Abu AlHassan)23-May-11 21:46
professionalAli Al Omairi(Abu AlHassan)23-May-11 21:46 
GeneralRe: array of file extentions Pin
Ali Al Omairi(Abu AlHassan)2-Nov-11 23:20
professionalAli Al Omairi(Abu AlHassan)2-Nov-11 23:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.