Re: searching and regex miniguide -- now new wiki page

new topic     » goto parent     » topic index » view thread      » older message » newer message
DanM said...
_tom said...

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

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu