Two simple examples:

Regular expression:
 grep("^[ \t]", x)
String manipulation:
 which(!is.na(match(substring(x, 1, 1), c(" ", "\t"))))
  • Regular expression:
        gsub("^From", "X-From:", h[1])
     
    String manipulation:
        if(sustring(h[1], 1, 4) == "From")
         h[1] = paste("X-From:", substring(h[1], 5), sep="")
     
  • What's this to do with Statistics

    Regular Expressions

    R Functions for Regular Expressions

    Meta-Characters

    Escaping Meta-Characters

    Alternatives

    Character Sets

    More on Character Sets

    Other Meta-Characters and Constructs

    Additional Number of Matches

    Grouping and References

    Substitutions and Replacements

    Web Log Substitution Example

    Pitfalls of Regular Expressions