The countries have the following form (country_value {tab_character} country_name):
Sample Input:
AD Andorra AE United Arab Emirates AF Afghanistan AG Antigua and Barbuda AI Anguilla AL Albania AM ArmeniaAn option html element has the following form:
There are two things we need to do:
- trim all the whitespaces
- Replace with the option tag
1. Trim all the whitespaces
You can trim all the whitespaces by matching the following:
Pattern: ^[ \t]+|[ \t]+$
Replace with: (nothing)
2. Replace with the option tag
Match them into two blocks, you can use \1 to reference first block (first matching parenthesis below),
Pattern: (.*)\t(.*)
Replace with:
No comments:
Post a Comment