Regexp.escape the href values

Hi All,

I want the skip the href values which is inside , while doing rake

task. but i am getting out put like this.

my text = rails

Rails is the keyword, but if already got linked, it should not link
again.

but i am getting output like this.

<a href=“Rails”>rails

its linking inside again.

for this i have used the Regexp.escape. but its not working as expected.

def match_string(s)
/(#{Regexp.escape(s)})(?!([^(<a)]*</a>)|(/)|\w)/
end

So, Please advise me, if anyone knows ASAP.

On May 27, 7:45 am, Vidya V. [email protected]
wrote:

end

This rather muddled. You haven’t really explained what the input is,
what the expected output is and exactly what that regular expression
is trying to match

Fred

Hi Fred,

Thanks for your reply.

My input will be:

 "The lion is the largest African carnivore. It is a sandy to tawny 

coloured cat with white under parts on which females often retain
rosettes and spots characteristic of younger animal.then the last one is
test

The keywords are : lion, animals, african, Tiger.

So my expected output are , when i am running the task , should be
linked the keywords with href. but except which is in href already.

Expected Output:

"The lion is the largest African carnivore. It is a sandy to tawny
coloured cat with white under parts on which females often retain
rosettes and spots characteristic of younger animal.then the last one is test

But right now i am getting like:

“The lion is the largest African carnivore. It is a sandy to tawny
coloured cat with white under parts on which females often retain
rosettes and spots characteristic of younger animal.then the last one is <a href=”Tiger">test

Note: See i am getting link twice , inside the href again and again.

it should not link , which is inside the href.

I hope u understand now.

Frederick C. wrote:

On May 27, 7:45�am, Vidya V. [email protected]
wrote:

�end

This rather muddled. You haven’t really explained what the input is,
what the expected output is and exactly what that regular expression
is trying to match

Fred

Linker should ignore keywords inside of hyperlinks

Example:

Tiger is a animal.

This text should be not link which is inside link tag.

Tiger is a animal.

But right now i am getting like

<a href=“animalAnimal”>Tiger is a animal.

Does it make sense?

Frederick C. wrote:

On 27 May 2008, at 10:36, Vidya V. wrote:

it should not link , which is inside the href.

that makes sense, what doesn’t make any sense is your regular
expression. What were you trying to make it do?

Fred

On 27 May 2008, at 17:16, Vidya V. wrote:

But right now i am getting like

<a href=“animalAnimal”>Tiger is a animal.

I got that first time round. What i don’t know is how you’re trying to
use that regular expression. a little more of your code would clarify
matters.

Fred

On 27 May 2008, at 10:36, Vidya V. wrote:

it should not link , which is inside the href.

that makes sense, what doesn’t make any sense is your regular
expression. What were you trying to make it do?

Fred