in reply to Re^3: Splitting an url in its components
in thread Splitting an url in its components

this is great and exactly what I was looking for :-)

for my personal learning purposes:

I don't fully understand the expression "(?:tar\.gz|^.+)"

- what does the part '?:tar\.gz' mean?

thanks so far for your help
ben
  • Comment on Re^4: Splitting an url in its components

Replies are listed 'Best First'.
Re^5: Splitting an url in its components
by moritz (Cardinal) on Jul 17, 2008 at 15:48 UTC
    There is no ?:tar\.gz part, because (?: ... ) has a distinct meaning (it's grouping without capturing), and tar\.gz just matches the string tar.gz.
Re^5: Splitting an url in its components
by Anonymous Monk on Jul 18, 2008 at 04:44 UTC
    Use <c> code here </c> tags (Markup in the Monastery).

    Install YAPE::Regex::Explain, because

    use YAPE::Regex::Explain; print YAPE::Regex::Explain->new(qr~(?:tar\.gz|[^.]+)~)->explain; __END__ The regular expression: (?-imsx:(?:tar\.gz|[^.]+)) matches as follows: NODE EXPLANATION ---------------------------------------------------------------------- (?-imsx: group, but do not capture (case-sensitive) (with ^ and $ matching normally) (with . not matching \n) (matching whitespace and # normally): ---------------------------------------------------------------------- (?: group, but do not capture: ---------------------------------------------------------------------- tar 'tar' ---------------------------------------------------------------------- \. '.' ---------------------------------------------------------------------- gz 'gz' ---------------------------------------------------------------------- | OR ---------------------------------------------------------------------- [^.]+ any character except: '.' (1 or more times (matching the most amount possible)) ---------------------------------------------------------------------- ) end of grouping ---------------------------------------------------------------------- ) end of grouping ----------------------------------------------------------------------