1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

wp-o-matic regex problem

Discussion in 'Blogging' started by meskalin, Mar 21, 2009.

  1. meskalin

    meskalin Newbie

    Joined:
    Mar 21, 2009
    Messages:
    9
    Likes Received:
    0
    i wanted to delete the links on the end of the feed post with this reges but ist doesnt work
     
  2. Matter

    Matter Newbie

    Joined:
    Mar 16, 2009
    Messages:
    28
    Likes Received:
    10
    I just tried to do something similar and got it working, so here's your answer:
    It doesn't work for you because your regex isn't really a regex. The most basic one would be
    Code:
     #1 
    and you'd want to replace it with $2 (term between the > and <).
    Since people tend to put extra tags, extra whitespace and all kind of garbage in their links, you'll probably want to use this:
    Code:
     #2 
    which catches all of that.
    Sorry, I tried to post the regexes as code, but that didn't work to well. I attached an image, but now you have to type it all in. Have fun ;)
     

    Attached Files:

    • Thanks Thanks x 1
  3. Blade__

    Blade__ Newbie

    Joined:
    Mar 30, 2009
    Messages:
    6
    Likes Received:
    1
    please text links... regex.pnd
     
  4. Matter

    Matter Newbie

    Joined:
    Mar 16, 2009
    Messages:
    28
    Likes Received:
    10
    What do you mean with "please text links"?
    Code:
    http://www.blackhatworld.com/blackhat-seo/attachments/blogging/2018d1238327669-wp-o-matic-regex-problem-regex.png
    How to use it:

    Go to your campaign settings in wp-o-matic. In the "Rewrite" tab, enter regex #2 under "Origin". Check the "Regex" checkbox. Check the "Rewrite to" checkbox. Put "$2" in the field below "Rewrite to" and save your settings.

    Now every link in the feed you pull will be replaced with the text between its a-tags, for example

    Code:
    <a href="http://somedomain.com">Some Text</a>
    will be replaced with

    Code:
    Some text
     
  5. sun

    sun Newbie

    Joined:
    Feb 6, 2008
    Messages:
    25
    Likes Received:
    15
    WP-o-Matic does it with preg_replace()
    Code:
    php.net/manual/en/book.pcre.php
    Regex patterns for preg family should be written as
    Code:
    /pattern/flags
    Where the two slashes are delimiters enclosing the pattern, flags (pattern modifiers) are optional. Delimiter can be (almost) any non alphanumeric character. Flags like "i" for ignore case, "u" for unicode, etc... So at least the delimiters missing from your original code.

    I use the following regex to clear all anchors form the posts (but keep any text/images/etc. inside the anchors):
    Code:
    #</?a[^>]*>#iu
    (Enable "Regex" and "Rewrite-to" checkboxes, and just leave the "Rewrite-to" textarea empty.)

    I hope it helps, and woks for you too (wit the original wp-o-matic plugin), because I've tweaked a lot in my wp-o-matic.
     
    • Thanks Thanks x 1
  6. mondmond88

    mondmond88 BANNED BANNED

    Joined:
    Apr 12, 2009
    Messages:
    200
    Likes Received:
    136
    can u explain how to use the regex function in wpomatic?
    i read few times thru this thread trying to comprehend but i stil dunno where should i place the codes and such
    any step by step for this?
    i wanna scrape off the remainder such as email this, digg it, and etc from the post, to make it clean

    thanks
     
    Last edited: Jul 6, 2009
  7. iglow

    iglow Elite Member

    Joined:
    Feb 20, 2009
    Messages:
    2,081
    Likes Received:
    856
    Home Page:
    Regex is preety simple but seems like somebody could make a tutorial for it - i tried to find for you people since im too lazy to write it here, but seems nobody made it yet :/
     
  8. mondmond88

    mondmond88 BANNED BANNED

    Joined:
    Apr 12, 2009
    Messages:
    200
    Likes Received:
    136

    cud you write it for us?
    cuz for wat im able to find
    u need to have $1, $2, and later on a section to place the symbols you want to match

    but i dunno where to place the symbols that i wanna match
    programmin is realli not my field althou i did learn a lil bit
     
  9. enSo

    enSo Regular Member

    Joined:
    Jul 15, 2009
    Messages:
    250
    Likes Received:
    301
    Occupation:
    Take a Guess
    Location:
    I don't quite understand how these work enough so I could do it myself, but I'm pretty sure there's a way to remove both the links and the anchor text if there is no character after them. This should just delete the link with credits and all that. Then for the other links in the post we can use the expression sun shared.
    Anyone mind sharing how that would be done ?
     
  10. frankey

    frankey Newbie

    Joined:
    Mar 30, 2010
    Messages:
    1
    Likes Received:
    0
    Hi there,

    I would be great if somebody could place a screenshot from the rewrite section where you a word is transformed!

    thanks