Mercurial > repos > bgruening > text_processing
comparison sed.xml @ 7:d64eace4f9f3 draft
Uploaded
| author | bgruening |
|---|---|
| date | Sat, 17 Jan 2015 08:30:15 -0500 |
| parents | 8928e6d1e7ba |
| children | 062ed2bb4f2e |
comparison
equal
deleted
inserted
replaced
| 6:8928e6d1e7ba | 7:d64eace4f9f3 |
|---|---|
| 100 - **s/hsa-mir-([^ ]+)/short name: \\1 full name: &/** will find strings such as 'hsa-mir-43a' (the regular expression is 'hsa-mir-' followed by non-space characters) and will replace it will string such as 'short name: 43a full name: hsa-mir-43a'. The **\\1** marker is a place holder for 'whatever matched the first parenthesis' (similar to perl's **$1**) . | 100 - **s/hsa-mir-([^ ]+)/short name: \\1 full name: &/** will find strings such as 'hsa-mir-43a' (the regular expression is 'hsa-mir-' followed by non-space characters) and will replace it will string such as 'short name: 43a full name: hsa-mir-43a'. The **\\1** marker is a place holder for 'whatever matched the first parenthesis' (similar to perl's **$1**) . |
| 101 | 101 |
| 102 | 102 |
| 103 **sed's Regular Expression Syntax** | 103 **sed's Regular Expression Syntax** |
| 104 | 104 |
| 105 The select tool searches the data for lines containing or not containing a match to the given pattern. A Regular Expression is a pattern descibing a certain amount of text. | 105 The select tool searches the data for lines containing or not containing a match to the given pattern. A Regular Expression is a pattern descibing a certain amount of text. |
| 106 | 106 |
| 107 - **( ) { } [ ] . * ? + \ ^ $** are all special characters. **\\** can be used to "escape" a special character, allowing that special character to be searched for. | 107 - **( ) { } [ ] . * ? + \ ^ $** are all special characters. **\\** can be used to "escape" a special character, allowing that special character to be searched for. |
| 108 - **^** matches the beginning of a string(but not an internal line). | 108 - **^** matches the beginning of a string(but not an internal line). |
| 109 - **(** .. **)** groups a particular pattern. | 109 - **(** .. **)** groups a particular pattern. |
| 110 - **{** n or n, or n,m **}** specifies an expected number of repetitions of the preceding pattern. | 110 - **{** n or n, or n,m **}** specifies an expected number of repetitions of the preceding pattern. |
| 111 | 111 |
| 112 - **{n}** The preceding item is matched exactly n times. | 112 - **{n}** The preceding item is matched exactly n times. |
| 113 - **{n,}** The preceding item ismatched n or more times. | 113 - **{n,}** The preceding item ismatched n or more times. |
| 114 - **{n,m}** The preceding item is matched at least n times but not more than m times. | 114 - **{n,m}** The preceding item is matched at least n times but not more than m times. |
| 115 | 115 |
| 116 - **[** ... **]** creates a character class. Within the brackets, single characters can be placed. A dash (-) may be used to indicate a range such as **a-z**. | 116 - **[** ... **]** creates a character class. Within the brackets, single characters can be placed. A dash (-) may be used to indicate a range such as **a-z**. |
| 117 - **.** Matches any single character except a newline. | 117 - **.** Matches any single character except a newline. |
| 118 - ***** The preceding item will be matched zero or more times. | 118 - ***** The preceding item will be matched zero or more times. |
| 119 - **?** The preceding item is optional and matched at most once. | 119 - **?** The preceding item is optional and matched at most once. |
| 120 - **+** The preceding item will be matched one or more times. | 120 - **+** The preceding item will be matched one or more times. |
| 121 - **^** has two meaning: | 121 - **^** has two meaning: |
| 122 - matches the beginning of a line or string. | 122 - matches the beginning of a line or string. |
| 123 - indicates negation in a character class. For example, [^...] matches every character except the ones inside brackets. | 123 - indicates negation in a character class. For example, [^...] matches every character except the ones inside brackets. |
| 124 - **$** matches the end of a line or string. | 124 - **$** matches the end of a line or string. |
| 125 - **\|** Separates alternate possibilities. | 125 - **\|** Separates alternate possibilities. |
| 126 | 126 |
| 127 | 127 |
| 128 **Note**: SED uses extended regular expression syntax, not Perl syntax. **\\d**, **\\w**, **\\s** etc. are **not** supported. | 128 **Note**: SED uses extended regular expression syntax, not Perl syntax. **\\d**, **\\w**, **\\s** etc. are **not** supported. |
| 129 | 129 |
| 130 @REFERENCES@ | 130 @REFERENCES@ |
| 131 ]]> | 131 ]]> |
| 132 </help> | 132 </help> |
| 133 </tool> | 133 </tool> |
