| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | VAC++ and it`s compiled regular exp |
Hi Doug,
Replying to a message of Doug Nazar to Mike Burgett:
MB>> struct TestRegEx *temp;
MB>> count = 0;
MB>> while(temp = testmask[count++])
MB>> {
MB>> if (regexec(&(testmask[count]->expr), checkstring, 0, 0) == 0);
MB>> break
MB>> }
DN> I'm hoping you typed this in by hand . Unless I'm missing something
DN> in your code, you're always skipping the first regex_t. You're also
DN> missing the last parameter of the regexec() call.
Yep, I did. (The 'if' statment should have used temp->expr anyway...)
DN> Ok, you really need to read up on regular expressions . The '*'
DN> modifier means to match 0 or more of the preceeding character. Hence,
DN> 'zee*' will match 'ze' and 'zeeeeee'. 'ab*' is matching the 'a' in
DN> 'dat'. 'j*' will match anything.
DN> You probably want 'zee.*' and 'ab.*'. Here is a sample util I just
DN> whipped up.
Exactly, except that I found that I could skip the '*'s completely and get
the results I wanted. (since I don't care where the match occured, unless
the expression was anchored to one end or the other, which still doesn't
require the '*' unless I care about something later in the expression like
'zee.*dat$'
I missed the _0_ or more in the regex explanation until the next morning,
after I'd sent the mail, when it jumped out and fairly bit me....
[... nice example deleted ...]
Thanks,
Mike
--- FleetStreet 1.17+
* Origin: Common Sense BBS - 510.713.7336 Newark, CA (1:215/705)SEEN-BY: 50/99 270/101 620/243 625/100 711/401 409 410 413 430 808 809 934 SEEN-BY: 711/955 712/407 515 624 628 713/888 800/1 @PATH: 215/705 270/101 712/515 711/808 934 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.