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

C#

 
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 
an IndexOf-based approach, when using several calls to such methods, has the disadvantage of scanning the string several times; a state-machine based approach typically scans just once.

I'm not sure what you mean by my first and second approach; the one with cSearch is a bit neater than the nested while loops, as it takes less code and scales better when more than a few items need to be present in a specific order. As I said, the speed difference would be minimal, the only overhead it adds is advancing one position in "search" each time the state-machine's state changes (as opposed to entering another nested while loop). When in doubt, just give it a try.

Smile | :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.


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 
GeneralRe: Regular Expressions Pin
AspDotNetDev10-Sep-10 7:21
protectorAspDotNetDev10-Sep-10 7:21 
GeneralRe: Regular Expressions [modified] Pin
Luc Pattyn10-Sep-10 7:31
sitebuilderLuc Pattyn10-Sep-10 7:31 
GeneralRe: Regular Expressions Pin
AspDotNetDev10-Sep-10 8:14
protectorAspDotNetDev10-Sep-10 8:14 
GeneralRe: Regular Expressions Pin
Bassam Abdul-Baki10-Sep-10 11:58
professionalBassam Abdul-Baki10-Sep-10 11:58 
GeneralRe: Regular Expressions Pin
Luc Pattyn10-Sep-10 17:02
sitebuilderLuc Pattyn10-Sep-10 17:02 
GeneralRe: Regular Expressions Pin
PIEBALDconsult11-Sep-10 15:59
mvePIEBALDconsult11-Sep-10 15:59 
GeneralRe: Regular Expressions Pin
Luc Pattyn11-Sep-10 16:11
sitebuilderLuc Pattyn11-Sep-10 16:11 
GeneralRe: Regular Expressions Pin
Bassam Abdul-Baki10-Sep-10 16:48
professionalBassam Abdul-Baki10-Sep-10 16:48 
GeneralRe: Regular Expressions Pin
Luc Pattyn10-Sep-10 4:20
sitebuilderLuc Pattyn10-Sep-10 4:20 
GeneralRe: Regular Expressions Pin
Bassam Abdul-Baki10-Sep-10 4:30
professionalBassam Abdul-Baki10-Sep-10 4:30 
GeneralRe: Regular Expressions Pin
Luc Pattyn10-Sep-10 4:41
sitebuilderLuc Pattyn10-Sep-10 4:41 

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.