# regexp

## 1 emacs regexp

These examples can be typed as written into the prompts of query-replace-regexp. For coding these into elisp strings, you need to escape the backslashes: \ -> \\.

• Find all occurances of \$…\$ and replace with \eqn{…} in R comments
```[ ][\$]\([^\$]*\)[\$]
\\eqn{\1}
```
• Find all attr(…,"source") and replace with getSource(…) in R code
```attr(\([a-z]+\), ?"source")
getSource(\1)
```
• Find all spaces before something and replace them with a comma (useful for converting space-delimited text to csv). Could also use lookahead.
```[ ]\([^ ]\)
\1
```

Date: 2011-08-26 14:12:46 CEST

HTML generated by org-mode 6.33x in emacs 23