I have a log that has the following url:
https://<hostname>/<directory>/builds/<job>/<version>/<build_number>
where:
hostname = any valid hostname
directory = any valid directory
job = any valid collection of characters (it may contain '-')
version = [0-9].[0-9] (i.e.) 1.0
build_number = [0-9] (i.e.) 2012050677
My intent is to read the log and use a regex to do the following:
- match the url
-
set an href using the url as follows:
<a href=matched_url>Latest build</a>
What kind of regex can I use to accomplish this?
Do a regex replace of
with
Alternatively
$0instead of$&, depending on your regex engine, probably.