Buying Modify a CGI routine

Discussion in 'Programming' started by rogan4567, Jul 6, 2012.

  1. #1
    I'm putting together an article / text spinning tool, and the spinning is done using this code:

    http://klepa.co/2011/10/06/perl-nested-article-spinner/

    Edit
    I'm looking to have this script work with spintags placed at the beginning of the string {{spin tags|go here} rest of the string|An alternate string}. When I originally posted this, I thought it was due to the empty spin tag, but it's actually any spintags double-brackets placed at the beginning. Basically, when the string starts with double brackets, it grabs too much.

    I think the problem lies in the above-referenced code:

    
    if($text =~ /$openingConstruct(.+?)$closingConstruct/s) {
    my $match = $1; 
    
    Code (markup):
    But, I'm not 100% certain.

    Examples:

    Problem format:
    
    {[B]{|Learn}[/B] How to fix a bathtub drain|How to {repair|fix} a {leaky|leaking} {tub|bath tub} drain}
    
    Results:
    
    Learn How to fix a bathtub drain|How to fix a leaking bath tub drain}
    Learn How to fix a bathtub drain|How to repair a leaky tub drain}
    Learn How to fix a bathtub drain|How to fix a leaky tub drain}
    Learn How to fix a bathtub drain|How to fix a leaking tub drain} 
    
    Working #1:
    
    {How to fix a bathtub drain|[B]{|Learn}[/B] How to {repair|fix} a {leaky|leaking} {tub|bath tub} drain}
    
    Results:
    
    Learn How to fix a leaking bath tub drain
    How to fix a bathtub drain
    How to repair a leaky tub drain
    How to fix a leaking bath tub drain
    How to repair a leaky bath tub drain
    How to repair a leaking bath tub drain 
    
    Working #2:
    
    
    {How to fix a bathtub drain|How to {repair|fix} a [B]{|leaky|leaking}[/B] {tub|bath tub} drain}
    
    Results:
    
    How to fix a leaking bath tub drain
    How to fix a bathtub drain
    How to fix a leaky bath tub drain
    How to repair a tub drain
    How to repair a leaky tub drain
    How to repair a leaking bath tub drain
    How to repair a leaky bath tub drain
    How to repair a bath tub drain 
    
    Working #3:
    
    {How to fix a bathtub drain|How to {repair|fix} a [B]{|leaky|leaking} {|tub|bath tub}[/B] drain}
    
    Results: 
    
    How to fix a bathtub drain
    How to fix a leaking bath tub drain
    How to fix a leaky tub drain
    How to repair a drain
    How to repair a leaky tub drain
    How to fix a leaky bath tub drain
    How to repair a leaking bath tub drain
    How to repair a tub drain
    How to repair a leaky bath tub drain 
    
    Working #4:
    
    
    {How to fix a bathtub drain|How to {repair|fix} a [B]{|leaky|leaking} {|tub|bath tub} {|drain}[/B]}
    
    Results:
    
    
    How to repair a tub drain
    How to fix a bathtub drain
    How to fix a leaking bath tub drain
    How to repair a leaking bath tub drain
    How to fix a leaky tub drain
    How to repair a
    How to repair a leaky tub drain
    How to fix a leaky bath tub drain
    How to repair a leaky bath tub drain
    How to repair a drain
    How to repair a leaky tub
    How to repair a tub 
    
    Code (markup):

    I'm looking for a price on how much it'd be to modify this to work with double brackets at the start of the string. I'm currently dumping results to MySQL so it wouldn't be easy for me to send you what I'm working with, but I can setup a simple script with all the code to test with.

    Thanks.
     
    Last edited: Jul 6, 2012
    rogan4567, Jul 6, 2012 IP