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 = <a href="Rails">rails</a> Rails is the keyword, but if already got linked, it should not link again. but i am getting output like this. <a href="<a href="http://localhost/dest/rails">Rails</a>">rails</a> 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. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On May 27, 7:45 am, Vidya Vidya <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Hi All, > > <a href="<a href="http://localhost/dest/rails">Rails</a>">rails</a> > > 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 >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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 <a href="Tiger">test</a> 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 <a href="www.animal.com">lion</a> is the largest <a href="www.animal.com">African</a> carnivore. It is a sandy to tawny coloured cat with white under parts on which females often retain rosettes and spots characteristic of younger <a href="www.animal.com">animal</a>.then the last one is <a href="Tiger">test</a> But right now i am getting like: "The <a href="www.animal.com">lion</a> is the largest <a href="www.animal.com">African</a> carnivore. It is a sandy to tawny coloured cat with white under parts on which females often retain rosettes and spots characteristic of younger <a href="www.animal.com">animal</a>.then the last one is <a href="<a href="www.animal.com">Tiger</a>">test</a> 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 Cheung wrote:> On May 27, 7:45�am, Vidya Vidya <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > 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-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 27 May 2008, at 10:36, Vidya Vidya wrote:> > "The <a href="www.animal.com">lion</a> is the largest <a > href="www.animal.com">African</a> carnivore. It is a sandy to tawny > coloured cat with white under parts on which females often retain > rosettes and spots characteristic of younger <a > href="www.animal.com">animal</a>.then the last one is <a href="<a > href="www.animal.com">Tiger</a>">test</a> > > Note: See i am getting link twice , inside the href again and again. > > 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> I hope u understand now. > > > > > > Frederick Cheung wrote: >> On May 27, 7:45�am, Vidya Vidya <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> >> 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 > > -- > Posted via http://www.ruby-forum.com/. > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Linker should ignore keywords inside of hyperlinks Example: <a href="Animal">Tiger</a> is a animal. This text should be not link which is inside link tag. <a href="Animal">Tiger</a> is a <a href="Animal">animal</a>. But right now i am getting like <a href="<a href="Animal">animal</a>Animal">Tiger</a> is a <a href="Animal">animal</a>. Does it make sense? Frederick Cheung wrote:> On 27 May 2008, at 10:36, Vidya Vidya 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-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 27 May 2008, at 17:16, Vidya Vidya wrote:> > Linker should ignore keywords inside of hyperlinks > > Example: > > <a href="Animal">Tiger</a> is a animal. > > This text should be not link which is inside link tag. > > <a href="Animal">Tiger</a> is a <a href="Animal">animal</a>. > > But right now i am getting like > > <a href="<a href="Animal">animal</a>Animal">Tiger</a> is a <a > href="Animal">animal</a>. >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> Does it make sense? > > Frederick Cheung wrote: >> On 27 May 2008, at 10:36, Vidya Vidya 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 > > -- > Posted via http://www.ruby-forum.com/. > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---