Click here to Skip to main content
15,887,962 members
Home / Discussions / C#
   

C#

 
GeneralRe: Regular Expressions Pin
Bassam Abdul-Baki10-Sep-10 4:26
professionalBassam Abdul-Baki10-Sep-10 4:26 
GeneralRe: Regular Expressions Pin
PIEBALDconsult10-Sep-10 4:37
mvePIEBALDconsult10-Sep-10 4:37 
GeneralRe: Regular Expressions Pin
Bassam Abdul-Baki10-Sep-10 4:46
professionalBassam Abdul-Baki10-Sep-10 4:46 
GeneralRe: Regular Expressions Pin
Alan Balkany10-Sep-10 4:02
Alan Balkany10-Sep-10 4:02 
GeneralRe: Regular Expressions Pin
Bassam Abdul-Baki10-Sep-10 4:11
professionalBassam Abdul-Baki10-Sep-10 4:11 
GeneralRe: Regular Expressions Pin
Alan Balkany10-Sep-10 4:12
Alan Balkany10-Sep-10 4:12 
GeneralRe: Regular Expressions Pin
Bassam Abdul-Baki10-Sep-10 4:15
professionalBassam Abdul-Baki10-Sep-10 4:15 
GeneralRe: Regular Expressions Pin
Alan Balkany10-Sep-10 4:22
Alan Balkany10-Sep-10 4:22 
A state machine uses a single int to mark where you are in your search. E.g.:

int state = 0;

foreach (char c in nextString)
    switch (state)
    {
        case (0): if (c == '6') state = 1;
            break;
        case (1): if (c == '2') state = 2;
           break;
        case (2): if (c == '4') state = 3;
           break;
    }

if (state == 3)
    return (FOUND);
else
    return (NOT_FOUND);


This is way faster than using regular expressions, which must handle much more complex cases.
GeneralRe: Regular Expressions Pin
Bassam Abdul-Baki10-Sep-10 4:27
professionalBassam Abdul-Baki10-Sep-10 4:27 
GeneralRe: Regular Expressions [modified] Pin
Luc Pattyn10-Sep-10 4:34
sitebuilderLuc Pattyn10-Sep-10 4:34 
GeneralRe: Regular Expressions Pin
Alan Balkany10-Sep-10 4:39
Alan Balkany10-Sep-10 4:39 
GeneralRe: Regular Expressions Pin
Luc Pattyn10-Sep-10 4:56
sitebuilderLuc Pattyn10-Sep-10 4:56 
GeneralRe: Regular Expressions Pin
Bassam Abdul-Baki10-Sep-10 4:40
professionalBassam Abdul-Baki10-Sep-10 4:40 
GeneralRe: Regular Expressions Pin
Bassam Abdul-Baki10-Sep-10 4:59
professionalBassam Abdul-Baki10-Sep-10 4:59 
GeneralRe: Regular Expressions Pin
Luc Pattyn10-Sep-10 5:19
sitebuilderLuc Pattyn10-Sep-10 5:19 
GeneralRe: Regular Expressions Pin
Bassam Abdul-Baki10-Sep-10 5:35
professionalBassam Abdul-Baki10-Sep-10 5:35 
GeneralRe: Regular Expressions Pin
Luc Pattyn10-Sep-10 5:49
sitebuilderLuc Pattyn10-Sep-10 5:49 
GeneralRe: Regular Expressions Pin
Bassam Abdul-Baki10-Sep-10 5:55
professionalBassam Abdul-Baki10-Sep-10 5:55 
GeneralRe: Regular Expressions Pin
Luc Pattyn10-Sep-10 6:00
sitebuilderLuc Pattyn10-Sep-10 6:00 
GeneralRe: Regular Expressions Pin
Bassam Abdul-Baki10-Sep-10 6:07
professionalBassam Abdul-Baki10-Sep-10 6:07 
GeneralRe: Regular Expressions Pin
harold aptroot10-Sep-10 6:27
harold aptroot10-Sep-10 6:27 
GeneralRe: Regular Expressions Pin
AspDotNetDev10-Sep-10 6:19
protectorAspDotNetDev10-Sep-10 6:19 
GeneralRe: Regular Expressions Pin
Bassam Abdul-Baki10-Sep-10 6:34
professionalBassam Abdul-Baki10-Sep-10 6:34 
GeneralRe: Regular Expressions Pin
Luc Pattyn10-Sep-10 6:40
sitebuilderLuc Pattyn10-Sep-10 6:40 
GeneralRe: Regular Expressions Pin
AspDotNetDev10-Sep-10 7:19
protectorAspDotNetDev10-Sep-10 7:19 

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.