If the URL is always exactly the same up to the point of the date that
you're capturing now (as it appears it must be for the expression to
match), you could create a capture group of the first 51 characters
(assuming I counted them right), and then use a backreference to that. I'm
not sure that would be better in any way, but it would be a shorter regex.

--Kerri

On Tue, Oct 1, 2019 at 2:05 PM David Rostenne <droste...@gmail.com> wrote:

> Hi folks,
>
> I have a regex that takes a url apart and makes me a csv of the components:
>
> Regex:
> http://ftp
> \.newedinburgh\.ca/wp-content/uploads/2019/[019]+/([0-9]+)[_.]([0-9]+)-([a-zA-Z]+).*
>
> and the replacement:
> \3 \1, NEN PDF, \1/\2/01, &
>
> which gives, for example:
> April 1976, NEN PDF, 1976/04/01,
> http://ftp.newedinburgh.ca/wp-content/uploads/2019/09/1976_04-April-New-Edinburgh-News_web.pdf
>
> I am wondering if there is a way to leave the http…2019 out of the regex
> and, instead of the & (which matches entire regex selection) in the
> replacement, use something else to represent the entire source line.
>
> As you can see i’ve found a solution.. but I am always curious to see if
> there is a simpler way.
>
> Cheers,
>
> Dave
>
> --
> This is the BBEdit Talk public discussion group. If you have a
> feature request or need technical support, please email
> "supp...@barebones.com" rather than posting to the group.
> Follow @bbedit on Twitter: <https://twitter.com/bbedit>
> ---
> You received this message because you are subscribed to the Google Groups
> "BBEdit Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to bbedit+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/bbedit/545B40B3-48A6-47FA-9161-ACE45EA55B3C%40gmail.com
> .
>

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or need technical support, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: <https://twitter.com/bbedit>
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/CAEmA4uZ-j0aRxfKXDmmwK0q0Va0E%2BLJ-wn2b0dswW_iyn-9s7A%40mail.gmail.com.

Reply via email to