Document regex replacement strings behavior. #139

Closed
wants to merge 3 commits into
from

Conversation

Projects
None yet
4 participants
Contributor

dcsobral commented Jan 25, 2012

All replacement methods use dolar signs to identify groups in the
matched string, and backslashes to escape characters. Document this
behavior, and provide a method that can be used to properly quote
replacement strings when this behavior is not desired.

Closes SI-4750.

Document regex replacement strings behavior.
All replacement methods use dolar signs to identify groups in the
matched string, and backslashes to escape characters. Document this
behavior, and provide a method that can be used to properly quote
replacement strings when this behavior is not desired.

Closes SI-4750.
+ * interpreted as a reference to a group in the matched pattern, with numbers
+ * 1 through 9 corresponding to the first nine groups, and 0 standing for the
+ * whole match. Any other character is an error. The backslash (`\`) character
+ * will be interpreted as a escape character, and can be used to escape the
@phaller

phaller Mar 23, 2012

Contributor

Typo: "will be interpreted as an escape character"

@dcsobral

dcsobral Mar 23, 2012

Contributor

Fixed.

+ *
+ * Replacement methods give special meaning to backslashes (`\`) and
+ * dollar signs (`$`) in replacement strings, so they are not treated
+ * as literals. This methods escapes these characters so the resulting
@phaller

phaller Mar 23, 2012

Contributor

Typo: "This method escapes these characters"

@dcsobral

dcsobral Mar 23, 2012

Contributor

Fixed.

Contributor

paulp commented Mar 23, 2012

Merged.

@paulp paulp closed this Mar 23, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment