Replace Pioneer Home
All Examples
Free Download
all
Advanced search and replace
Replace text in multiple files
Regular expression replace
Batch file rename
Batch download
Text file parser
Text file splitter
Html text generator
Search replace binary
Random word generator
Count and statistics
Character encoding
Bin Hex Oct Dec converter
Text generator
Text sort
Text merge
Text data calculation
RSS: Replace Pioneer Examples
1255.Regular expression replace -- How to remove the first part of format A_B_A in each word?
User:
Marvin -- 2014-09-29
<< 1254
1256 >>
Hits:
3307
Type:
Regular expression replace
Search all
Regular expression replace
examples
Description:
Dear Staff of RP,
Sorry for asking another question.
How could I change "First_RB_first" into "RB_first"?
Input Sample:
First_RB_first of_IN_of all_DT_all
students_NNS_students can_MD_can only_RB_only
Output Sample:
RB_first IN_of DT_all
NNS_students MD_can RB_only
Answer:
Hint: You need to
Download and install "Replace Pioneer"
on windows platform to finish following steps.
1. ctrl-o open text file
2. ctrl-h open 'replace' dialogue
* set 'search for pattern' to:
(?i)(\b[^_\s]+)_([^_\s]+_\1)\b
* set 'replace with pattern' to:
$2
3. click 'replace', done
4. ctrl-s save to file.
Note: if you just need to remove A_ from A_B_C, please use following formula in step 2:
(\b[^_\s]+)_([^_\s]+_[^_\s]+)\b
Screenshot 1: Replace_Window
Similar Examples:
How to remove the first pair of parenthesis and enclosed content in each line?
(57%)
How to remove the first 10 characters of each line in text file?
(57%)
How to replace the first 3 spaces into comma in each line of text?
(56%)
How to batch replace files with specified format in each line?
(54%)
How to rename many files to the format of file.number.ext?
(54%)
How to remove or keep the lines started with a word of number?
(52%)
How to remove everything from start of line to the first comma in each line?
(52%)
How to remove everything before first space in filename?
(51%)
Check Demo of
Regular expression replace
Keywords:
question
regular expression
expression
format
each word
regular
regula
regular exp
the first
step
remove first word expression
remove text first word
remove word from text file
remove first word
replace text from another file
replace another
replace in part
another file