Click here to Skip to main content
15,894,955 members
Home / Discussions / C#
   

C#

 
GeneralRegular Expressions Pin
Bassam Abdul-Baki10-Sep-10 3:53
professionalBassam Abdul-Baki10-Sep-10 3:53 
GeneralRe: Regular Expressions Pin
Luc Pattyn10-Sep-10 3:58
sitebuilderLuc Pattyn10-Sep-10 3:58 
GeneralRe: Regular Expressions Pin
Bassam Abdul-Baki10-Sep-10 4:09
professionalBassam Abdul-Baki10-Sep-10 4:09 
GeneralRe: Regular Expressions Pin
PIEBALDconsult10-Sep-10 4:24
mvePIEBALDconsult10-Sep-10 4:24 
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 
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 
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 

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.