# Regular Expression help - Replacing Regexp that worked with Oniguruma in 1.8.6

**URL:** <https://rubytalk.org/t/regular-expression-help-replacing-regexp-that-worked-with-oniguruma-in-1-8-6/61899>\
**Category:** ruby-talk\
**Created:** [20 February 2011 19:31 UTC](https://rubytalk.org/t/regular-expression-help-replacing-regexp-that-worked-with-oniguruma-in-1-8-6/61899 "2011-02-20T19:31:33Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zeno\_Davatz](https://avatars.discourse-cdn.com/v4/letter/z/258eb7/32.png) [@Zeno\_Davatz](https://rubytalk.org/u/Zeno_Davatz)\
**Post date:** [20 February 2011 19:31 UTC](https://rubytalk.org/t/regular-expression-help-replacing-regexp-that-worked-with-oniguruma-in-1-8-6/61899/1 "2011-02-20T19:31:33Z")

</div>

Hi

On our way to shifting to Ruby 1.8.7 - away from the beloved  
Oniguruma-Patch - I am tripping over our usefull regular expression used  
in Ruby 1.8.6 - so if anybody is strong in refactoring regular  
expressions, please let me know.

sample one:

[http://choddb.rubyforge.org/ODDB/SwissmedicPlugin.html](http://choddb.rubyforge.org/ODDB/SwissmedicPlugin.html)

%r{excipiens\s+(ad|pro)\s+(?\<galform\>((?!\bpro\b)[^.])+)}u

and

%r{pro\s+(?\<scale\>(?\<qty\>[\d.,]+)\s\*(?\<unit\>[kcmuµn]?[glh]))}u

And this one on line 148

> **[URL.ba - skraćujmo domaće.](https://url.ba)**
>
> URL.ba je domaći automatski 'skraćivač' dugih linkova.

All three samples need to work in Ruby 1.8.7 and in 1.9.2.

They currently work perfectly fine in Ruby 1.8.6 with the beloved  
Oniguruma-Patch V2.5.9

Any hints or Feedback is welcome.

Best  
Zeno

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

---

<div class="post-metadata">

**Author:** ![Robert\_K1](https://yyz1.discourse-cdn.com/flex029/user_avatar/rubytalk.org/robert_k1/32/1830_2.png) [@Robert\_K1](https://rubytalk.org/u/Robert_K1)\
**Post date:** [21 February 2011 08:15 UTC](https://rubytalk.org/t/regular-expression-help-replacing-regexp-that-worked-with-oniguruma-in-1-8-6/61899/2 "2011-02-21T08:15:46Z")

</div>

Can you give hints about what exactly you are asking? Do you have  
syntax errors, do the expressions not match? What is the reason for  
your posting?

Ideally you would provide sample code and text to match.

Cheers

robert

> **···**
>
> On Sun, Feb 20, 2011 at 8:31 PM, Zeno Davatz \<zdavatz@gmail.com\> wrote:
> 
> > On our way to shifting to Ruby 1.8.7 - away from the beloved  
> > Oniguruma-Patch - I am tripping over our usefull regular expression used  
> > in Ruby 1.8.6 - so if anybody is strong in refactoring regular  
> > expressions, please let me know.
> > 
> > sample one:
> > 
> > [http://choddb.rubyforge.org/ODDB/SwissmedicPlugin.html](http://choddb.rubyforge.org/ODDB/SwissmedicPlugin.html)
> > 
> > %r{excipiens\s+(ad|pro)\s+(?\<galform\>((?!\bpro\b)[^.])+)}u
> > 
> > and
> > 
> > %r{pro\s+(?\<scale\>(?\<qty\>[\d.,]+)\s\*(?\<unit\>[kcmuµn]?[glh]))}u
> > 
> > And this one on line 148
> > 
> > [Url.ba](http://url.ba/kxez)
> > 
> > All three samples need to work in Ruby 1.8.7 and in 1.9.2.
> > 
> > They currently work perfectly fine in Ruby 1.8.6 with the beloved  
> > Oniguruma-Patch V2.5.9
> > 
> > Any hints or Feedback is welcome.
> 
> --  
> remember.guy do |as, often| as.you\_can - without end  
> [http://blog.rubybestpractices.com/](http://blog.rubybestpractices.com/)

---

<div class="post-metadata">

**Author:** ![John\_W\_Higgins1](https://yyz1.discourse-cdn.com/flex029/user_avatar/rubytalk.org/john_w_higgins1/32/1922_2.png) [@John\_W\_Higgins1](https://rubytalk.org/u/John_W_Higgins1)\
**Post date:** [21 February 2011 20:30 UTC](https://rubytalk.org/t/regular-expression-help-replacing-regexp-that-worked-with-oniguruma-in-1-8-6/61899/3 "2011-02-21T20:30:16Z")

</div>

Good Afternoon,

> **···**
>
> On Sun, Feb 20, 2011 at 11:31 AM, Zeno Davatz \<zdavatz@gmail.com\> wrote:
> 
> > Hi
> > 
> > On our way to shifting to Ruby 1.8.7 - away from the beloved  
> > Oniguruma-Patch - I am tripping over our usefull regular expression used  
> > in Ruby 1.8.6 - so if anybody is strong in refactoring regular  
> > expressions, please let me know.
> 
> Could you provide some samples of inputs and what you expect/are getting out  
> of the expressions. Rather difficult to ensure one can be of assistance  
> without knowing the specific targets.....
> 
> John

---

<div class="post-metadata">

**Author:** ![Zeno\_Davatz](https://avatars.discourse-cdn.com/v4/letter/z/258eb7/32.png) [@Zeno\_Davatz](https://rubytalk.org/u/Zeno_Davatz)\
**Post date:** [21 February 2011 16:40 UTC](https://rubytalk.org/t/regular-expression-help-replacing-regexp-that-worked-with-oniguruma-in-1-8-6/61899/4 "2011-02-21T16:40:25Z")

</div>

Dear Robert

> \> On our way to shifting to Ruby 1.8.7 - away from the beloved  
> \> Oniguruma-Patch - I am tripping over our usefull regular expression used  
> \> in Ruby 1.8.6 - so if anybody is strong in refactoring regular  
> \> expressions, please let me know.
> 
> \> sample one:
> 
> \>[http://choddb.rubyforge.org/ODDB/SwissmedicPlugin.html](http://choddb.rubyforge.org/ODDB/SwissmedicPlugin.html)
> 
> \> %r{excipiens\s+(ad|pro)\s+(?\<galform\>((?!\bpro\b)[^.])+)}u
> 
> \> and
> 
> \> %r{pro\s+(?\<scale\>(?\<qty\>[\d.,]+)\s\*(?\<unit\>[kcmuµn]?[glh]))}u
> 
> \> And this one on line 148
> 
> \>[Url.ba](http://url.ba/kxez)
> 
> \> All three samples need to work in Ruby 1.8.7 and in 1.9.2.
> 
> \> They currently work perfectly fine in Ruby 1.8.6 with the beloved  
> \> Oniguruma-Patch V2.5.9
> 
> \> Any hints or Feedback is welcome.
> 
> Can you give hints about what exactly you are asking? Do you have  
> syntax errors, do the expressions not match? What is the reason for  
> your posting?

Basically our software does not start-up with Ruby 1.8.7 and with Ruby  
1.9.2 as Oniguruma is missing.

> Ideally you would provide sample code and text to match.

Ok, I will try to produce these beyond what I already supplied above.

Best  
Zeno

> **···**
>
> On 21 Feb., 03:15, Robert Klemme \<shortcut...@googlemail.com\> wrote:
> 
> > On Sun, Feb 20, 2011 at 8:31 PM, Zeno Davatz \<zdav...@gmail.com\> wrote:

---

<div class="post-metadata">

**Author:** ![Ryan\_Davis1](https://yyz1.discourse-cdn.com/flex029/user_avatar/rubytalk.org/ryan_davis1/32/1848_2.png) [@Ryan\_Davis1](https://rubytalk.org/u/Ryan_Davis1)\
**Post date:** [21 February 2011 19:44 UTC](https://rubytalk.org/t/regular-expression-help-replacing-regexp-that-worked-with-oniguruma-in-1-8-6/61899/5 "2011-02-21T19:44:30Z")

</div>

He's just taking another opportunity to complain that a patch that he privately applied to 1.8.6 wasn't applied to 1.8.7 or 1.9. Instead of either sticking to what he likes or migrating his code (in this case named groups--really not hard if he'd just think about it), he's complaining. Again. Ad nauseum. Just like he did on ruby-core@.

> **···**
>
> On Feb 21, 2011, at 00:15 , Robert Klemme wrote:
> 
> > Can you give hints about what exactly you are asking? Do you have  
> > syntax errors, do the expressions not match? What is the reason for  
> > your posting?

---

<div class="post-metadata">

**Author:** ![Robert\_K1](https://yyz1.discourse-cdn.com/flex029/user_avatar/rubytalk.org/robert_k1/32/1830_2.png) [@Robert\_K1](https://rubytalk.org/u/Robert_K1)\
**Post date:** [22 February 2011 08:17 UTC](https://rubytalk.org/t/regular-expression-help-replacing-regexp-that-worked-with-oniguruma-in-1-8-6/61899/6 "2011-02-22T08:17:54Z")

</div>

> Dear Robert
> 
> > \> On our way to shifting to Ruby 1.8.7 - away from the beloved  
> > \> Oniguruma-Patch - I am tripping over our usefull regular expression used  
> > \> in Ruby 1.8.6 - so if anybody is strong in refactoring regular  
> > \> expressions, please let me know.
> > 
> > \> sample one:
> > 
> > \>[http://choddb.rubyforge.org/ODDB/SwissmedicPlugin.html](http://choddb.rubyforge.org/ODDB/SwissmedicPlugin.html)
> > 
> > \> %r{excipiens\s+(ad|pro)\s+(?\<galform\>((?!\bpro\b)[^.])+)}u
> > 
> > \> and
> > 
> > \> %r{pro\s+(?\<scale\>(?\<qty\>[\d.,]+)\s\*(?\<unit\>[kcmuµn]?[glh]))}u
> > 
> > \> And this one on line 148
> > 
> > \>[Url.ba](http://url.ba/kxez)
> > 
> > \> All three samples need to work in Ruby 1.8.7 and in 1.9.2.
> > 
> > \> They currently work perfectly fine in Ruby 1.8.6 with the beloved  
> > \> Oniguruma-Patch V2.5.9
> > 
> > \> Any hints or Feedback is welcome.
> > 
> > Can you give hints about what exactly you are asking? Do you have  
> > syntax errors, do the expressions not match? What is the reason for  
> > your posting?
> 
> Basically our software does not start-up with Ruby 1.8.7 and with Ruby  
> 1.9.2 as Oniguruma is missing.

Since when is Oniguruma missing from 1.9.2???

09:14:24 ~$ for e in ruby ruby19; do $e -v; $e -ce '/(?\<name\>)/'; done  
ruby 1.8.7 (2008-08-11 patchlevel 72) [i386-cygwin]  
-e:1: undefined (?...) sequence: /(?\<name\>)/  
ruby 1.9.2p136 (2010-12-25 revision 30365) [i386-cygwin]  
Syntax OK  
09:14:33 ~$

If you migrate away from 1.8.6 then why do you switch to 1.8.7 and not  
1.9.\* which is significantly faster \*and\* has Oniguruma?

> > Ideally you would provide sample code and text to match.
> 
> Ok, I will try to produce these beyond what I already supplied above.

Yes, I think you should do that.

Kind regards

robert

> **···**
>
> On Mon, Feb 21, 2011 at 5:40 PM, Zeno R.R. Davatz \<zdavatz@gmail.com\> wrote:
> 
> > On 21 Feb., 03:15, Robert Klemme \<shortcut...@googlemail.com\> wrote:
> > 
> > > On Sun, Feb 20, 2011 at 8:31 PM, Zeno Davatz \<zdav...@gmail.com\> wrote:
> 
> --  
> remember.guy do |as, often| as.you\_can - without end  
> [http://blog.rubybestpractices.com/](http://blog.rubybestpractices.com/)
