# Regexp simple question

**URL:** <https://www.ruby-forum.com/t/regexp-simple-question/167690>\
**Category:** Ruby\
**Created:** [May 11, 2009, 4:51pm UTC](https://www.ruby-forum.com/t/regexp-simple-question/167690 "2009-05-11T16:51:56Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![arunvoip](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e8c25b/32.png) [@arunvoip](https://www.ruby-forum.com/u/arunvoip)\
**Post date:** [May 11, 2009, 4:51pm UTC](https://www.ruby-forum.com/t/regexp-simple-question/167690/1 "2009-05-11T16:51:56Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![arunvoip](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e8c25b/32.png) [@arunvoip](https://www.ruby-forum.com/u/arunvoip)\
**Post date:** [May 11, 2009, 5:43pm UTC](https://www.ruby-forum.com/t/regexp-simple-question/167690/2 "2009-05-11T17:43:54Z")

</div>

In words, describe what just the regex part does.

---

<div class="post-metadata">

**Author:** ![arunvoip](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e8c25b/32.png) [@arunvoip](https://www.ruby-forum.com/u/arunvoip)\
**Post date:** [May 11, 2009, 5:45pm UTC](https://www.ruby-forum.com/t/regexp-simple-question/167690/3 "2009-05-11T17:45:10Z")

</div>

7stud – wrote:

> In words, describe what just the regex part does.

I mean the part between the

- tags.

---

<div class="post-metadata">

**Author:** ![arunvoip](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e8c25b/32.png) [@arunvoip](https://www.ruby-forum.com/u/arunvoip)\
**Post date:** [May 11, 2009, 5:46pm UTC](https://www.ruby-forum.com/t/regexp-simple-question/167690/4 "2009-05-11T17:46:46Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![arunvoip](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e8c25b/32.png) [@arunvoip](https://www.ruby-forum.com/u/arunvoip)\
**Post date:** [May 11, 2009, 9:41pm UTC](https://www.ruby-forum.com/t/regexp-simple-question/167690/5 "2009-05-11T21:41:06Z")

</div>

That bugle’s been blown to death mate.

Jayanth

---

<div class="post-metadata">

**Author:** ![arunvoip](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e8c25b/32.png) [@arunvoip](https://www.ruby-forum.com/u/arunvoip)\
**Post date:** [May 11, 2009, 6:06pm UTC](https://www.ruby-forum.com/t/regexp-simple-question/167690/6 "2009-05-11T18:06:12Z")

</div>

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!
