You don’t need character classes for single characters:
Set = /[[1-9]\d]/
Field = /FS?[1-9]\d*/
Makes for slightly better looking expressions. I thought this was the
case, but didn’t bother to check.
How about:
SetThenField = /#{Set}(\s)*#{Field}\s/
(This is all untested but it might point you in a helpful direction.)
Seems to work actually. I had found an old groups post about using #{}
within regular expressions but didn’t bother to try it because of the
way they had explained it.
I was thinking of doing it this way but it seems somewhat unruby. From
these responces though it looks like i’ll have to tack some tiny method
on to regexp to achieve this, i was hoping that this functionality was
a part of regexp (or somewhere else in ruby) and that i had just missed
it.
Geoff
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.