Jump to content

terrypin

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

terrypin's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks for the follow-ups. Still experimenting. Will report back when I have a clearer picture. I suspect TextPad (for the basic regex) plus my macro program (for the iteration across multiple lines) might be my best approach. I'm also determined to master more of Regex itself! -- Terry, East Grinstead, UK
  2. Thanks Playful, appreciate your help. The Regex in TextPad seems pretty good, with the usual Find/Replace functionality: http://dl.dropbox.com/u/4019461/TextPad-Regex-1.jpg But its repertoire and syntax as I said seems radically different. In that code you suggested ',(?sm)\[([^]]+.jpg)\].*?- COMMENT -(\r\n[^[]*),' I don't recognise/understand: - the commas - '(?sm) - [^] - \r (although I think it means CR? Why do I need that? Isn't Return ' \n' sufficient? - * on its own, instead of '.*' As mentioned, I'm just a Regex novice, so maybe much of this is obvious stuff to you! -- Terry, East Grinstead, UK
  3. Thanks Joe, much appreciate that fast response. However, I realise now that I forgot an important point! My post here turns out to be somewhat OT, as I'm not a PHP user. Not even a programmer, just an end user using Regex ((the POSIX version apparently) in my text editor, TextPad. I had assumed that 'PHP Regex' would be close enough for me to make any necessary syntax changes. But obviously I was mistaken, as TextPad Regex looks quite different. No preg_match_all for example! But your post has inspired me to come at the problem from a totally different angle. Instead of trying to find those strings I described, and replace them with blanks, I should Find the individual names inside the initial square brackets, giving me the filename. And then the line(s) directly after '- COMMENT -' and before the following open square bracket. Both of those should be fairly easy I think. The challenge then however is how to do this for all such pairs? BTW, this is the first forum I've joined (I use scores of them) that makes me complete image verification and answer test questions even though I've already regsitered! Bit OTT isn't it? -- Terry, East Grinstead, UK
  4. I'm hoping one of the experts can help please. I have a text file that looks like this: --- Start paste --- [blackfordLane.jpg] File name = BlackfordLane.jpg Directory = C:\Docs\My Videos\PROJECTS\Thames Path Walk Projects\TP03 Project\Geograph Photos\GeoDay2\ Compression = JPEG, quality: 87, subsampling OFF Resolution = 96 x 96 DPI File date/time = 19/01/2012 / 15:01:23 - IPTC - Object Name - s bridge over the River Thames is not a footbridge but carries pipes. - COMMENT - Thames Path on Blackford Lane heading towards Blackford Farm, east of Castle Eaton. [Castle Eaton Church.jpg] File name = Castle Eaton Church.jpg Directory = C:\Docs\My Videos\PROJECTS\Thames Path Walk Projects\TP03 Project\Geograph Photos\GeoDay2\ Compression = JPEG, quality: 87, subsampling OFF Resolution = 72 x 72 DPI File date/time = 19/01/2012 / 14:03:55 - EXIF - Make - FUJIFILM Model - FinePix2600Zoom Orientation - Top left XResolution - 72 YResolution - 72 ResolutionUnit - Inch - COMMENT - Castle Eaton Church [CastleEaton-2.jpg] File name = CastleEaton-2.jpg Directory = C:\Docs\My Videos\PROJECTS\Thames Path Walk Projects\TP03 Project\Geograph Photos\GeoDay2\ Compression = JPEG, quality: 75 Resolution = 0 x 0 DPI File date/time = 18/01/2012 / 15:40:05 - COMMENT - The Red Lion, Castle Eaton A warm welcoming pub on a cold winter's day, with the River Thames running at the bottom of the garden. And this is what I want to get as a result: BlackfordLane.jpg Thames Path on Blackford Lane heading towards Blackford Farm, east of Castle Eaton. Castle Eaton Church.jpg Castle Eaton Church CastleEaton-2.jpg The Red Lion, Castle Eaton A warm welcoming pub on a cold winter's day, with the River Thames running at the bottom of the garden. My first line of attack is to try for a Regex expression that will Find everything (for example) between the ']' of '[blackfordLane.jpg]' and the '-' of '- COMMENT -'? That would leave only a little tidying up, I think. But so far it's eluded me after a couple of hours. The best I could come up with was the following to delete all lines from File name... to File date/time (with the Replace box empty): File name = .*\nDirectory = .*\nCompression = .*\nResolution = .*\nImage dimensions = .*\nPrint size = .*\nColor depth = .*\nNumber of unique colors = .*\nDisk size = .*\nCurrent memory size = .*\nFile date/time = .*\n But that's only part of the task and seems very inelegant. Any suggestions please? -- Terry, East Grinstead, UK
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.