views:

397

answers:

2

Hi I'm a newbie I am trying to create a regex in notepad ++ to replace all href="http://www.reactivemail.com/(any series of charcters)"

essentially all I want is to put a / on the end of all href's but only if it does not contain a dot e.g it is a path to a file like .html

so here is what i want to find

href="http://www.reactivemail.com(some path to a directory)"

but ignore href="http:www.reactivemail.com(some path).some extension"

and want to add a / to href's that only go to a directory and are missing a / on the end

this is the regex I am using:

(href="http:\/\/www\.reactivemail\.com[^\.*.*"*]*)

and the replace is \1/

it finds what I want perfectly

only for href's with a .file extension it still finds the path and ignores everything after the. instead of ignoring everything because it contains a dot

how do i do this?

A: 

It's a bit dangerous (see my comment to your question), but you can try searching for:

(href="http://www.reactivemail.com/[^."]*[^/])"

and replacing with

\1/"
Tim Pietzcker
More precisely: replace `(href="http:\/\/www\.reactivemail\.com[^.]*[^/])(")` with `\1/"`
Jeremy Stein
A: 

Try this (http[s]*\://[^\"]+)/([^\."/]+)" and replace with \1/\2/". This should catch every http and https url, but will miss the folders with periods in them.

Andrew Redd