Regular expression: Difference between revisions
Jump to navigation
Jump to search
→Troubleshooting of regular expression
(→尋找數字) |
|||
| Line 656: | Line 656: | ||
== Troubleshooting of regular expression == | == Troubleshooting of regular expression == | ||
Tips | Tips | ||
* Use online tool [https://regex101.com/ regex101: build, test, and debug regex] to obtain the explain of your syntax | |||
* Small data test: (1) Prepare the small file data to verify the syntax (2) Using the [[Regular_expression#Regular_expression_online_tools | online tools]] | * Small data test: (1) Prepare the small file data to verify the syntax (2) Using the [[Regular_expression#Regular_expression_online_tools | online tools]] | ||
* Highlight or output the matched text e.g. {{kbd | key=<nowiki>--color</nowiki>}}<ref>[https://www.cyberciti.biz/faq/howto-use-grep-command-in-linux-unix/grep_command_examples/ Grep -color command Examples - nixCraft]</ref> for grep command or output the matches by PHP [http://php.net/manual/en/function.preg-match.php preg_match()] function. | * Highlight or output the matched text e.g. {{kbd | key=<nowiki>--color</nowiki>}}<ref>[https://www.cyberciti.biz/faq/howto-use-grep-command-in-linux-unix/grep_command_examples/ Grep -color command Examples - nixCraft]</ref> for grep command or output the matches by PHP [http://php.net/manual/en/function.preg-match.php preg_match()] function. | ||