I spent awhile today trying to convert a regular expression from Ruby to NSRegularExpression. It was being dumb and took me awhile to figure it out.
The main this is NSRegularExpression's options. By default Ruby, has AnchorsMatchLines
on and NSRegularExpression doesn't. I simply turned that on and had good luck.
Front Matter
Here's my specific case (Jekyll front-matter ):
Ruby
/\A(---\s*\n.*?\n?)^(---\s*$\n?)/m
Swift
NSRegularExpression ( pattern : " \\ A(--- \\ s* \\ n.*? \\ n?)^(--- \\ s*$ \\ n?)" , options : . DotMatchesLineSeparators | . AnchorsMatchLines , error : nil ) !
After watching Particle Fever , I got inspired to do a daily video journal thing . Particle Fever is a documentary about the Large Hadron Collider (which is super interesting). They had video from some of the scientists’ daily video journals over the years of working on it. It was really cool to watch.
I got inspired and thought it would be fun to do my own. Not that any of my work is anywhere near as meaningful as theirs, it’s still fun to just do it. I’ve found it’s really enjoyable to summarize what I’m doing each day. I was surprised how much it effect my focus day to day.
Personal Sam is named after a Twitter account I used to have. My friend Aaron Marshall , Over ’s founder, used to have @personalaaron. It was just him complaining about his boss and whatnot. I thought it was awesome and started @personalsam. It was mainly me winning about girls and how emo my life was back in 2008. Anyway, it seemed like a fitting name for my podcast thing and I already had the domain.
Continue reading →
© 2006-2024 Sam Soffes