Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Substituting a comma only when it is preceded and followed by a bracket (closure)

by tye (Sage)
on Nov 02, 2011 at 17:22 UTC ( #935447=note: print w/replies, xml ) Need Help??


in reply to Substituting a comma only when it is preceded and followed by a bracket

my $l= ''; $s =~ s{([(,)])}{ my $n= ',' eq $1 && '(' eq $l ? ';' : $1; $l= $1 if ',' ne $1; $n }ge

- tye        

  • Comment on Re: Substituting a comma only when it is preceded and followed by a bracket (closure)
  • Download Code

Replies are listed 'Best First'.
Re^2: Substituting a comma only when it is preceded and followed by a bracket (closure)
by choroba (Bishop) on Nov 02, 2011 at 17:26 UTC
    Does not work for nested parentheses *ducks*
    $s='aa, aaa, aaaa, aaa, (aaa, aaa, aaa, a), aaa, aaa, (aaa, aaa, (aaa, + aa), aaa, aaa), aaa, aaa';

      Ah, but I guess it beats BrowserUk's solution because it must be clearer that it doesn't work for nested parens else you wouldn't have left his un-replied-to for 22 minutes but replied to mine in 5 minutes when both fail for that same case. q-:

      - tye        

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://935447]
help
Chatterbox?
[Corion]: Yeah, CryTek got blindsided (or whatever) by Unity and Unreal Engine being zero cost, and the CryTek documentation being bad/nonexistent I think
[Corion]: "zero monetary cost", because of course, it's gratis only if your time has no value :)
[marto]: I used to keep up to date with my android ROMs, updating to the nightly every other day
[marto]: in my experience the jump in major releases has been painless, and performed better
[marto]: Corion if your device has an official Oreo ROM I'd do a nandroid backup and give it a shot

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (4)
As of 2017-12-14 10:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What programming language do you hate the most?




















    Results (389 votes). Check out past polls.

    Notices?