Regexp simple question

Hi,
I’m using the following regexp to capture a particular string from a
japanese website content.

/

    .?
  • ([^<]
  • ?)</li>/m

    The following is the match result.

    女性 /

    Is there a way I can remove the slash(’/’) from my result by modifying
    the above regular expression.

    N. B. gsub can be used but I want to know whether there it can be
    achieved by modifying the above regexp

    Please help.

    Thanks
    Arun

In words, describe what just the regex part does.

7stud – wrote:

In words, describe what just the regex part does.

I mean the part between the

  • tags.
  • Your boss doesn’t like gsub?

    Try

    /

      .?
    • ([^</]
    • ?)</li>/m

      That should work, but it won’t work for a case where you have /
      separating
      something in the inner text.

      Jayanth

    That bugle’s been blown to death mate.

    Jayanth

    Arun K. wrote:

    I’m using the following regexp to capture a particular string from a
    japanese website content.

    /

      .?
    • ([^<]
    • ?)</li>/m

    Parsing HTML with Regexp makes certain baby dieties cry.

    Use Nokogiri, with an XPath of ‘/ul[ @id = “ownerProfile” and @class =
    “owner” ]’. Then pull out the .text and you are done!

    This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

    | Privacy Policy | Terms of Service | Remote Ruby Jobs