<< Squep @ Rohstofflager | Home | Das Piratenkind @ Reaktor >>

OMC Progress Bar Update

A more consise regular expression, thanks to the boffins at stackoverflow.com
Bookmark and Share

One little thing about the OnMyCommand progress bar post that had been bothering me was the long, repetitive nature of the regular expression.  After much fiddling about I had settled on a 121 characher monster.  It worked, but was somewhat inelegant.  Not being a regular expressions guru, I posted a question on stackoverflow: Repetition of group patterns in a regex pattern

Within two hours there were viable answers, and within a day the best working answer (at 67 characters, 55% of the original) was in place, supplied by Chas. Owens

Mine:
^\s*([^ ]+)\s+([^ ]+)\s+([^ ]+)\s+([^ ]+)\s+([^ ]+)\s+([^ ]+)\s+([^ ]+)\s+([^ ]+)\s+([^ ]+)\s+([^ ]+)\s+([^ ]+)\s+([^ ]+)

Chas. Owens:
^\s*([^ ]+)\s+([^ ]+)\s+(?:[^ ]+\s+){3}([^ ]+)\s+[^ ]+\s+([^ ]+)\s+

One small difference in the OMC configuration is needed also: Change the progress 'Status' text to "Uploading $3 of $2 ($1%) at $4Bps" as the group identifiers are different. I am pleased.



Add a comment Send a TrackBack