Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
rhizome
on May 20, 2013
|
parent
|
context
|
favorite
| on:
\d less efficient than [0-9]
Use the s/, Luke
s/^\s+?(.*)\s+?$/$1/g
conroe64
on May 20, 2013
[–]
That wouldn't work. First, it will only grab at only one whitespace character at the beginning and at the end. Second, if there was whitespace at the beginning or the end but not both, it won't match at all. "^\s* (.* ?)\s* $/$1/g" would work.
rhizome
on May 20, 2013
|
parent
[–]
point being: get rid of the anchors in the alternation.
Consider applying for YC's Fall 2026 batch!
Applications
are open till July 27.
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: