in reply to Truncating after the last period

"Remove all characters after the last period" can also be re-stated as, "keep all characters up to a period," relying upon the default 'greedy' behavior to slurp as many characters as it can. Keep what the regular-expression keeps (if it kept anything at all, otherwise leave the string unchanged as it contains no period at all).

Replies are listed 'Best First'.
Re^2: Truncating after the last period
by BrowserUk (Patriarch) on Aug 22, 2011 at 19:51 UTC
    "Remove all characters after the last period" can also be re-stated as, "keep all characters up to a period,"

    Not if there can be two or more periods in the first 400 characters.


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.