Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

Here's a statement of the obvious: The opinions expressed here are those of the participants, not those of the Mutual Fund Observer. We cannot vouch for the accuracy or appropriateness of any of it, though we do encourage civility and good humor.

    Support MFO

  • Donate through PayPal

Please fix linkification code

edited August 2011 in Technical Questions
Please fix the linkification code that if the ticker is part of a URL (i.e. not a stand alone token) the linkification should not be performed. Example Ted's URL to marketwatch.

http://www.marketwatch.com/investing/fund/VUSTX;

I've pasted alternative hex encoded representation of the URL to get the correct behavior above. If I were not to encode it and simply paste the URL, the linkification software would break it. This must be fixed. Below is the broken behavior.

http://www.marketwatch.com/investing/fund/VUSTX

Comments

  • edited August 2011



    VUSTX (OAKBX)

    reply to @Investor
    What you say is obvious the logic that should be followed. The problem lies with the implementation.of the pattern matching.

    a callback function is called on the message and it is parsed as so

    with a preg_replace_callback function in php.

    the patttern in PCRE is this

    new RegEx --------- '/\b\p{Lu}{3,6}\b/u'

    I suggested a mod like this

    my suggested RegEx --------- '/\S*\b\p{Lu}{3,6}\b/u';

    However, words at the beginning of the column don't work.

    What is your suggested replacement string.

    investor's replacement REGEX ____________________________


    Until the fix is in: the easiest workaround is to lowercase ticker or your plan.

    when people post links to funds they can try lowercasing the ticker symbol in the link and if the site read lowercase or converts it it will work.
    http://www.marketwatch.com/investing/fund/vustx
    (VUSTX)
  • I am not that well versed in PCRE regex syntax but I think the problem is coming from \b (word break) is not interpreted as we would like. Maybe the following would work.

    /\s+\p{Lu}{3,6}\s+|^\p{Lu}{3,6}\s+|\s+\p{Lu}{3,6}$|^\p{Lu}{3,6}$/u

    If \s includes \n, perhaps it could be reduced to:

    /\s+\p{Lu}{3,6}\s+|^\p{Lu}{3,6}\s+/u

    I actually would prefer \p{L} only in above to cover both upper and lower case.
  • edited August 2011
    x
  • edited August 2011
    There is a couple of problems. It does not work in the first column. This was what I was trying to take care with ^\p{Lu}{3,6}

    Ticker in first column
    VWESX

    Also there are issues of eating parts of the text. See the test cases at: http://www.mutualfundobserver.com/discuss/index.php?p=/discussion/1007/ping-brad-chip-bee-techies...highlighted-tickers-inoperative-in-my-posts-others-ok-
  • edited August 2011
    x
  • edited August 2011
    x
  • edited August 2011
    x
  • edited August 2011
    x
  • Reply to @Accipiter: Testing again PRPFX
    PRPFX (no leading space)
    PRPFX (leading space)

  • edited August 2011
    x
Sign In or Register to comment.