[Kmymoney] Regular expressions

Koos Pol kmymoney at pohw.nl
Sat Oct 10 09:04:25 UTC 2015



Op 10-10-15 om 08:12 schreef Email Terra Rhaufed:
>
> Someone cam help me understand regular expressions and drive me to
> where I can learn how to put it in use? I feel it can solve a report
> issue (I need to create a report not available) I have.
>


Ciao Rhaufed,

Regular expressions are like smart filters. In stead of pointing to one
specific entry in a list, you are filtering out those your are
interested in. And you describe that filter using a regular expression.

Support you have a list of food items. And you are interested in those
that contain the word apple.
Than you could use the regexp */apple/*. This will match all the words
containing the word apple:
- apple
- apples
- applejuice
- pineapple

If you are only interested in the items that start with the word apple,
you adapt the regexp. You add the ^ (carrot). The carrot means: "start
at the beginning of the pattern".
Your regexp now looks like */^apple/*.
This regepx will match the words:
- apple
- apples
- applejuice

It will not match the word pineapple, as it does not start with apple.

The reverse is also true: you can use a regexp to match words that end
with apple. Than the regexp looks like */apple$/*.
This will match the words:
- apple
- pineapple


Regexp are tricky. They can become pretty cryptic pretty soon. Secondly,
there is no one correct regexp implementation. For instance, Perl
regular expressions have more tokens and are more powerful. So you need
to know in advance which implementation is used.

For online help I can suggest : http://regexone.com/
That is the quickest way forward. After that, you just have to do it and
learn it the hard way :-D

Good luck!
Koos



 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kmymoney/attachments/20151010/30201ea3/attachment.html>


More information about the KMyMoney mailing list