Pattern Builder
Replace Pioneer - text/binary/web file - Batch search,replace,convert,rename,split,download    Functions  Print_unmatched_units_Flag 


<font color=red>!! This function is retired since version 2.5 !!</font>



It is not easy for the beginner to build a complicate Pattern for text replacement.



The introduction of powerful "Pattern Builder" enables users to build a complicate pattern in a short time.



By clicking "Pattern Builder" button in "Replace Dialog" window, a "Pattern Builder Dialog" will pop-up:





The procedure to build a Replace Pattern consists of 4 parts:



1. Text Selector(Sample Text before Replace Window)


It is in the top window of the Dialogbox, user need to put a sample text for replacement at the window, and select part of the text with mouse.


2. Pattern Selector


After text is selected, system will provide a list of candidate patterns for user to select.


3. Function Selector


After the pattern is selected, system will provide a list of candidate functions for the pattern, user can select one of functions and click "Add to Pattern".


4. Pattern Window


The added pattern will be inserted into the Pattern window. User can also edit this window to make change.



There is a "Sample Text after Replace" window under the "Sample Text before Replace" Window, system will automatically generate a realtime Output Samples in this window once the Pattern or Input Sample text changes.



Example of using "Pattern Builder":



Assume user want to make a change on each line, remove last word and change all characters to upper case.



Before replace, each line like:


This is sample line one



After replace, each line like:







1. In "Replace Dialog", set "replace unit" to "Line", set "search for pattern" to ".*"(means any line)



2. Click "Pattern Builder" pattern, the "Pattern Builder Dialog" is poped-up.


3. Put sample text into Sample Text window.



4. Select all words except last word, the patterns in Pattern Selector will be created.



5. Select "&words($match,1,-2) --- words [1 to -2]" pattern from Pattern Selector(words[1 to -2] means select from 1st word to 2nd word from end).



6. Select "&uc(&words($match,1,-2)) ---[upper case] THIS IS SAMPLE LINE" from function selector



7. Click "Add to Pattern", the pattern will be built in the pattern window. The output sample will also be appeared immediately in the "Sample Text After Replace Window".



8. But you will find the word of sample output text was separated by "Tab" key(default), not "Space". You can do either of following to make correction:


1) Change the "output word delimiter" to "Space" in "Settings" page of "Replace Dialog"


2) Edit the function directly to apply "Space" as separator.


Here we use the 2nd, change the words function like:


&uc(&words($match,1,-2,undef,' ')) set input delimiter unchanged, output delimiter to ' '(space)



You will now find the Output Samples is changed to correct format.


9. Click 'OK', the result will be filled into "Replace With Pattern" window, then click "Replace", the operation is finished.