NSRegularExpression Notes — Hi, I’m Sam
source link: https://soffes.blog/nsregularexpression-notes
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
NSRegularExpression Notes — Hi, I’m Sam
NSRegularExpression Notes — Hi, I’m Sam
Hi, I’m Sam
This is my blog. I also have a website thing.
NSRegularExpression Notes
Posted on December 23, 2014
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):
/\A(---\s*\n.*?\n?)^(---\s*$\n?)/m
Swift
NSRegularExpression(pattern: "\\A(---\\s*\\n.*?\\n?)^(---\\s*$\\n?)", options: .DotMatchesLineSeparators | .AnchorsMatchLines, error: nil)!
Personal Sam
Posted on December 5, 2014
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.
© 2006-2022 Sam Soffes
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK