|Aug 3, 2006, 04:23 PM||#1|
grep, regular expressions, HTML files
I could use a little help here. Alright, let's say I have this here HTML file, and I want to extract some of the things in brackets (which are just placeholders - in the HTML files I'm actually extracting data from there will be actual content where the brackets are) using grep, then send that data to a file.
I'm not entirely sure which regular expressions to use. Also, for a given piece of data I don't want the regular expression to return more than one match.
Oh, ignore all the broken links and images in the linked-to HTML file - they're supposed to be broken.
iMac Intel (Rev H, 27"), 1TB HDD, 16GB RAM, 10.8.4
|Aug 3, 2006, 07:49 PM||#2|
What you're looking for is something like this:
This matches a pair of square brackets with or without stuff in the middle. The ? makes * ungreedy -- it will return the shortest match possible. The brackets I think must be escaped since they have special meaning in a regex.
|Thread Tools||Search this Thread|
|thread||Thread Starter||Forum||Replies||Last Post|
|Help! HTML files won't load from local drive?||carbonmotion||Web Design and Development||15||Aug 24, 2013 12:49 AM|
|Help with TextWrangler GREP?||JacobJones||Mac Applications and Mac App Store||1||Jun 13, 2013 06:40 AM|
|Safari: Auto-open .html files rather than downloading||Nick Jinks||OS X||11||Apr 9, 2013 02:28 PM|
|grep syntax help||Big Dave||Mac Programming||4||Jan 24, 2013 08:54 AM|
|Help! How to convert local HTML files to PDFs?||timidhermit||Mac Applications and Mac App Store||4||Oct 8, 2012 10:16 AM|
All times are GMT -5. The time now is 05:41 PM.