Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^2: matching numeric range

by state-o-dis-array (Hermit)
on Feb 24, 2005 at 23:18 UTC ( #434300=note: print w/replies, xml ) Need Help??


in reply to Re: matching numeric range
in thread matching numeric range

I'm liking this. One question on this. Is there a simple way (one line regex substitution for example) to get from B10-15 to B1[0-5], or B120-125 to B12[0-5]? Actually, as I think about it, I may need to apply some logic to handle B18-24. Can you think of a good way to handle this one?

Replies are listed 'Best First'.
Re^3: matching numeric range
by jimbojones (Friar) on Feb 24, 2005 at 23:36 UTC
    Hi

    the B10-15 example is easy: B1[0-5] (character class), as is B120-125 (B12[0-5]). As you say, logic spanning B18-24 is more difficult; that's why I broke it into 2 regexs in my post above. It was easier to match B1[8-9] or B2[0-4] than to try some regex-fu. You may be more adept with regexes than I am.

    - j

    update: escape out [ ] so they're visible.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://434300]
help
Chatterbox?
[zentara]: marto arn't those NSA secrets? :-)
[marto]: not if you keep telling people :P
[zentara]: I had to disable hyperthreading on my machine because of that.
[Discipulus]: thanks marto but... at the moment this seems a bit beyond my faculties.. ;=)
[zentara]: a thread goes into a wait state after emitting a wait to all other threads. It locks up a machine completely.
[marto]: if you mean the recent hyperthreading bug, I don't think that's NSA related?
[zentara]: s/thread/cpu/
[marto]: xkcd://538
[Discipulus]: these opcodes mentioned in the wiki pages are the same opcode perl is translated into? or is just the same term but in different fields?

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (11)
As of 2017-07-28 12:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I came, I saw, I ...
























    Results (428 votes). Check out past polls.