Issue with regex

I have a string

Default
SharpChart

When i use the Regulator to create a regex it matches. my sample is
“http(.)+[”]

It returns
http://stockcharts.com/h-sc/ui?s=ACN.TO&id=p41804099534&a=81626743&listNum=30”>

However when i use ruby, it returns
When i use ruby with syntax a.scan(/“http(.)+[”]/)

It returns [[“t”]]

can someone help determine what error i am doing

Hi –

On Mon, 7 Aug 2006, [email protected] wrote:

It returns [[“t”]]

can someone help determine what error i am doing

When you use parenthetical captures, String#scan returns successive
arrays of those captures. In the case of your scan, you’ve matched
the string once, and captured “t” in the first () group.

If you want a substring that starts with "http and ends with ", you
can do:

a[/“http[^”]+"/]

David

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