View Single Post
Old 07-22-2013, 09:31 PM   #1551
JimmXinu
Plugin Developer
JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.
 
JimmXinu's Avatar
 
Posts: 7,025
Karma: 4604635
Join Date: Dec 2011
Location: Midwest USA
Device: Kobo Clara Colour running KOReader
Quote:
Originally Posted by Jade Aislin View Post
Code:
 ships_LIST=>\((.*?)\)( )?(.*?),=>\3 (\1),
 ships_LIST=>\((.*?)\)( )?(.*?)$=>\3 (\1)
However the second line, used for the last ship in the list, is moving the parenthesis tag, but it is not getting rid of the original parenthesis. My output goes from 'O (One-Sided) (Family)/P' to 'O (One-Sided) (Family)/P (One-Sided)'.

Is there a reason that the last line of code is moving the tag I want, but is not deleting it from the original position?
\((.*?)\) matches (non-greedy) (something)

(.*?) matches (non-greedy) anything--including additional (something) strings.

I'd experiment with using something like ([^\(]*?)--match (non-greedy) anything except open paren.

Frankly, there's a lot of trial and error in using complex regular expressions, even for experienced users.
JimmXinu is offline