comparison find_and_replace.xml @ 7:d64eace4f9f3 draft

Uploaded
author bgruening
date Sat, 17 Jan 2015 08:30:15 -0500
parents 8928e6d1e7ba
children c78b1767db2b
comparison
equal deleted inserted replaced
6:8928e6d1e7ba 7:d64eace4f9f3
19 '$infile' 19 '$infile'
20 ]]> 20 ]]>
21 </command> 21 </command>
22 <inputs> 22 <inputs>
23 <param name="infile" format="txt" type="data" label="File to process" /> 23 <param name="infile" format="txt" type="data" label="File to process" />
24 <param name="find_pattern" type="text" size="20" label="Find pattern" help="Use simple text, or a valid regular expression (without backslashes // ) " > 24 <param name="find_pattern" type="text" size="20" label="Find pattern" help="Use simple text, or a valid regular expression (without backslashes // ) " >
25 <sanitizer> 25 <sanitizer>
26 <valid initial="string.printable"> 26 <valid initial="string.printable">
27 <remove value="&apos;"/> 27 <remove value="&apos;"/>
28 </valid> 28 </valid>
29 </sanitizer> 29 </sanitizer>
133 133
134 ----- 134 -----
135 135
136 **Example 2** 136 **Example 2**
137 137
138 **Find Pattern:** ^chr 138 **Find Pattern:** ^chr
139 **Replace Pattern:** (empty) 139 **Replace Pattern:** (empty)
140 **Regular Expression:** yes 140 **Regular Expression:** yes
141 **Replace what:** column 11 141 **Replace what:** column 11
142 142
143 If column 11 (of every line) begins with ther letters 'chr', they will be removed. Effectively, it'll turn "chr4" into "4" and "chrXHet" into "XHet" 143 If column 11 (of every line) begins with ther letters 'chr', they will be removed. Effectively, it'll turn "chr4" into "4" and "chrXHet" into "XHet"
145 145
146 ----- 146 -----
147 147
148 **Perl's Regular Expression Syntax** 148 **Perl's Regular Expression Syntax**
149 149
150 The Find & Replace 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. 150 The Find & Replace 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.
151 151
152 - **( ) { } [ ] . * ? + \\ ^ $** are all special characters. **\\** can be used to "escape" a special character, allowing that special character to be searched for. 152 - **( ) { } [ ] . * ? + \\ ^ $** are all special characters. **\\** can be used to "escape" a special character, allowing that special character to be searched for.
153 - **^** matches the beginning of a string(but not an internal line). 153 - **^** matches the beginning of a string(but not an internal line).
154 - **(** .. **)** groups a particular pattern. 154 - **(** .. **)** groups a particular pattern.
155 - **{** n or n, or n,m **}** specifies an expected number of repetitions of the preceding pattern. 155 - **{** n or n, or n,m **}** specifies an expected number of repetitions of the preceding pattern.
156 156
157 - **{n}** The preceding item is matched exactly n times. 157 - **{n}** The preceding item is matched exactly n times.
158 - **{n,}** The preceding item ismatched n or more times. 158 - **{n,}** The preceding item ismatched n or more times.
159 - **{n,m}** The preceding item is matched at least n times but not more than m times. 159 - **{n,m}** The preceding item is matched at least n times but not more than m times.
160 160
161 - **[** ... **]** 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**. 161 - **[** ... **]** 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**.
162 - **.** Matches any single character except a newline. 162 - **.** Matches any single character except a newline.
163 - ***** The preceding item will be matched zero or more times. 163 - ***** The preceding item will be matched zero or more times.
164 - **?** The preceding item is optional and matched at most once. 164 - **?** The preceding item is optional and matched at most once.
165 - **+** The preceding item will be matched one or more times. 165 - **+** The preceding item will be matched one or more times.
166 - **^** has two meaning: 166 - **^** has two meaning:
167 - matches the beginning of a line or string. 167 - matches the beginning of a line or string.
168 - indicates negation in a character class. For example, [^...] matches every character except the ones inside brackets. 168 - indicates negation in a character class. For example, [^...] matches every character except the ones inside brackets.
169 - **$** matches the end of a line or string. 169 - **$** matches the end of a line or string.
170 - **\\|** Separates alternate possibilities. 170 - **\\|** Separates alternate possibilities.
171 - **\\d** matches a single digit 171 - **\\d** matches a single digit
172 - **\\w** matches a single letter or digit or an underscore. 172 - **\\w** matches a single letter or digit or an underscore.
173 - **\\s** matches a single white-space (space or tabs). 173 - **\\s** matches a single white-space (space or tabs).
174 174
175 @REFERENCES@ 175 @REFERENCES@