Re: searching and regex miniguide -- now new wiki page
- Posted by DanM Oct 05, 2010
- 1621 views
My progress so far in creating a miniguide for searching and regex is http://openeuphoria.org/wiki/euwiki.ex?Searching.
This is the first draft. Comments and wisdom are welcome.
I think it looks VERY nice, but I don't know much at all about regex, so maybe there's things there not so good that I miss. I do wonder what:
meaning regex wildcard
means, though. Its in a section about "?" not being the same in regex and in a wildcard.
But the above didn't show up in preview in the same way as I saw it in the wiki nor how it showed as I pasted it in this post; in this post, it copied as a mix of double ampersands separated by spaces, and in the wiki it presented as what I take to be a different kind or font for ampersands also separated by spaces.
Regular expressions are more complex than simple wildcards. Basically, it is possible to define much more complex patterns than simple wildcards would allow. It's also possible to designate parts of the match for use later. Basically, to find a certain part of the string that you're interested in.
As to your question (I think the markup was a mistake), in a regular expression, a dot (.) matches any character. It's similar to what a question mark does with 'normal' wildcards. With a regex, however, it is possible to use a quantifier, to say how many characters it should match. A question mark indicates that the preceding character is optional for the match to be good. An asterisk after a character means 0 or many. A plus sign means one or more. You can also use curly braces to specify an actual number. That scratches the surface, but hopefully helps.
Matt
Thanks Matt,
I was beginning to understand the entry itself, past the confusing ampersands, but every little bit of info helps, so thanks for your additional explanation.
I figured the ampersands were some kind of error, that's why I pointed it out.
Dan