/ (?: # non capture group start ftp:\/{2} # ftp:// )? # end optional non-capture group (?: # non capture group start .*?\/ # anything non-greedy, followed by a / ){5} # end non-capture group, match five times (.*?) # capture everything, non-greedy \/ # until the very next fwd slash /x
Note that you can stringify that into a single line and put it back into the variable. The x modifier allows you to have whitespace in the regex for clarity, and adding comments.
In reply to Re: Complicated regexp problem
by stevieb
in thread Complicated regexp problem
by stefanches7
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |