Link to home
Start Free TrialLog in
Avatar of oggiemc
oggiemcFlag for Ireland

asked on

PCRE regular expression

Hello all,

Im new to PCRE regex syntax and i was wondering could i get a bit of help. Im trying to match the following target strings:

finance | f.inance | fi.nance | fin.ance etc

i.e the full stop can occur anywhere in the the target string. And i want the regex to match all possibilities.. How can i achieve this with one regex?

Thanks,
SOLUTION
Avatar of kaufmed
kaufmed
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of oggiemc

ASKER

That works kaufmed..Im just wondering though is there a cleaner way to do this? i.e without having to put the search pattern after each character? also, i will be searching for all punctuation characters so i would have to have something like the following:

[.*^%$£]?f[.*^%$£]?i[.*^%$£]?n[.*^%$£]?

Which begins to look quite messy..is there no way of putting the search characters i.e [.*^%$£]at the end of the regex and then specify a global search in the target string?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of oggiemc

ASKER

Thanks for replies kaufmed..You have given me a few options there..I will leave question open for the meantime just to see if there are any other suggestions..
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial