Jump to navigation Jump to search

You are not logged in. Please consider registering an account. By having a StrategyWiki account, you can have your own user page, upload images for your guide, and even customize the look of the site to match your tastes! Also, another benefit of registering an account is that your IP address is not logged whenever you edit, so it adds security and privacy as well. Sign up today! It takes less than one minute and requires no personal information — you're not even required to provide an e-mail address!

If you choose not to register, don't worry! You can still edit StrategyWiki all the same, just with fewer luxuries than registered users have. Your IP address will be recorded in this page's edit history, you must use the Show Preview feature to check over your work before being allowed to save your changes, and your edit may be scrutinized a bit more than that of a registered user's edit. If you don't wish any of the preceding things to happen to you or your edit, please log in or register. Please make sure that you are following all applicable policies and guidelines when making your edit, and we hope that you continue to contribute to StrategyWiki in the future!

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.

Latest revision Your text
Line 1: Line 1:
{{stub}}
{{Header Nav|game=StrategyWiki:Guide}}
{{Header Nav|game=StrategyWiki:Guide}}
{{wikipedia|Regular expression}}
{{wikipedia|Regular expression}}
{{floatingtoc|left}}
Regular expressions, often referred to as a regex or regexp, plural regexes or regexps, are used to help find changes that need to be replaced and to replace them.
Regular expressions, often referred to as a regex or regexp, plural regexes or regexps, are used to help find changes that need to be replaced and to replace them.


{{-}}
==Tools==
==Tools==
To use a regular expression you will have to have find a code base that can run it. The easiest tools to use are:
To use a regular expression you will have to have find a code base that can run it. The easiest tools to use are:
*Google Chrome extension: [https://chrome.google.com/webstore/detail/search-and-replace/bldchfkhmnkoimaciljpilanilmbnofo Search and Replace 1.2.2]
*Google Chrome extension: [https://chrome.google.com/webstore/detail/search-and-replace/bldchfkhmnkoimaciljpilanilmbnofo Search and Replace 1.2.2]
*TextPad (go to Search >> Replace, or press F8). Note: TextPad used to use Unix's implementation and syntax, but now uses Perl/JavaScript's.
*TextPad (go to Search >> Replace, or press F8)


==Syntax differences==
==Syntax differences==
Note that some tools code their regular expression syntax differently. Major differences occur between programming languages and shells; e.g. Unix vs. Perl/JavaScript implementations.
Note that some tools code their regular expression syntax differently. For example, TextPad makes uses of simplified expressions, such as [:alpha:] to match a-z and A-Z.


Example: a simple parameter definition search in Unix may look like (this matches all characters a-b and 0-9, minimum of 1 time and maximum of 25 times in a single match):
;Uses
<pre>
\(a-b,0-9)\{1,25\}\)
</pre>
 
In Perl/Javascript syntax it looks like:
<pre>
(a-b,0-9){1,25}
</pre>
 
For example, TextPad makes uses of simplified expressions, such as [:alpha:] to match a-z and A-Z.
 
==Example uses==
*Adding a hundred file names to a table. See [http://strategywiki.org/w/index.php?title=Animal_Crossing:_New_Leaf/List_of_Fossils&diff=prev&oldid=674718 this example].
*Adding a hundred file names to a table. See [http://strategywiki.org/w/index.php?title=Animal_Crossing:_New_Leaf/List_of_Fossils&diff=prev&oldid=674718 this example].
**Regex used (in old TextPad Unix syntax): <nowiki>"| || \([[:alpha:][:blank:]]\{10,20\}\) || \(.\{1,10\}\) Bells"</nowiki> (without quotes).
**Regex used (in TextPad): "| || \([[:alpha:][:blank:]]\{10,20\}\) || \(.\{1,10\}\) Bells" (without quotes).
*Simplifying all lines with five character or above Pokemon names, and their identification number, in {{t|PokePic}}.
**Regex used (in new Textpad Perl/JavaScript syntax; without quotes): <nowiki>"\|([[:alpha:]]{5,25}) = [[][[]File[:]Pokemon ([0-9]{3})\{\{\{1\}\}\}.png\{\{!\}\}\{\{\{2\|40px\}\}\}\{\{!\}\}\{\{\{3\|none\}\}\}\]\]"</nowiki>


{{Footer Nav|game=StrategyWiki:Guide|prevpage=Advanced tables|nextpage=Templates}}
{{Footer Nav|game=StrategyWiki:Guide|prevpage=Advanced tables|nextpage=Templates}}
Please note that all contributions to StrategyWiki are considered to be released under the Creative Commons Attribution-ShareAlike (see StrategyWiki:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here. You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. DO NOT SUBMIT COPYRIGHTED WORK WITHOUT PERMISSION!
Cancel Editing help (opens in new window)

Notice to contributors: The StrategyWiki administration does not condone plagiarism or the use of materials from any other source. Period. By saving this page you are promising us that you wrote this yourself, or copied it from a public domain or similar free resource. With the exception of official media (screenshots, artwork, symbols, etc., but not text) and materials released under the CC-BY-SA you must have the rights to or ownership of all work you submit to StrategyWiki. Do not copy text or images from other websites without permission. They will be deleted.

Copy and paste: – — ° ′ ″ ≈ ≠ ≤ ≥ ± − × ÷ ← → · §   Sign your posts on talk pages: ~~~~   Cite your sources: <ref></ref>


{{}}   {{{}}}   |   []   [[]]   [[Category:]]   #REDIRECT [[]]   &nbsp;   <s></s>   <sup></sup>   <sub></sub>   <code></code>   <pre></pre>   <blockquote></blockquote>   <ref></ref> <ref name="" />   {{Reflist}}   <references />   <includeonly></includeonly>   <noinclude></noinclude>   {{DEFAULTSORT:}}   <nowiki></nowiki>   <!-- -->   <span class="plainlinks"></span>


{{Header Nav|game={{subst:BASEPAGENAME}}}}   {{Footer Nav|game={{subst:BASEPAGENAME}}|prevpage=|nextpage=}}   {{spoilers}}   {{spoiler|}}   {{delete|Unused}}   {{rename|MS Monster .png}}   {{floatingtoc}}   {{stub}}


Symbols: ~ | ¡ ¿ † ‡ ↔ ↑ ↓ • ¶   # ∞   ‘ ’ “ ” ‹› «»   ¤ ₳ ฿ ₵ ¢ ₡ ₢ $ ₫ ₯ € ₠ ₣ ƒ ₴ ₭ ₤ ℳ ₥ ₦ № ₧ ₰ £ ៛ ₨ ₪ ৳ ₮ ₩ ¥   ♠ ♣ ♥ ♦   ♭ ♯ ♮   © ® ™
Latin: A a Á á À à  â Ä ä Ǎ ǎ Ă ă Ā ā à ã Å å Ą ą Æ æ Ǣ ǣ   B b   C c Ć ć Ċ ċ Ĉ ĉ Č č Ç ç   D d Ď ď Đ đ Ḍ ḍ Ð ð   E e É é È è Ė ė Ê ê Ë ë Ě ě Ĕ ĕ Ē ē Ẽ ẽ Ę ę Ẹ ẹ Ɛ ɛ Ǝ ǝ Ə ə   F f   G g Ġ ġ Ĝ ĝ Ğ ğ Ģ ģ   H h Ĥ ĥ Ħ ħ Ḥ ḥ   I i İ ı Í í Ì ì Î î Ï ï Ǐ ǐ Ĭ ĭ Ī ī Ĩ ĩ Į į Ị ị   J j Ĵ ĵ   K k Ķ ķ   L l Ĺ ĺ Ŀ ŀ Ľ ľ Ļ ļ Ł ł Ḷ ḷ Ḹ ḹ   M m Ṃ ṃ   N n Ń ń Ň ň Ñ ñ Ņ ņ Ṇ ṇ Ŋ ŋ   O o Ó ó Ò ò Ô ô Ö ö Ǒ ǒ Ŏ ŏ Ō ō Õ õ Ǫ ǫ Ọ ọ Ő ő Ø ø Œ œ   Ɔ ɔ   P p   Q q   R r Ŕ ŕ Ř ř Ŗ ŗ Ṛ ṛ Ṝ ṝ   S s Ś ś Ŝ ŝ Š š Ş ş Ș ș Ṣ ṣ ß   T t Ť ť Ţ ţ Ț ț Ṭ ṭ Þ þ   U u Ú ú Ù ù Û û Ü ü Ǔ ǔ Ŭ ŭ Ū ū Ũ ũ Ů ů Ų ų Ụ ụ Ű ű Ǘ ǘ Ǜ ǜ Ǚ ǚ Ǖ ǖ   V v   W w Ŵ ŵ   X x   Y y Ý ý Ŷ ŷ Ÿ ÿ Ỹ ỹ Ȳ ȳ   Z z Ź ź Ż ż Ž ž   ß Ð ð Þ þ Ŋ ŋ Ə ə   {{Unicode|}}
Greek: Ά ά Έ έ Ή ή Ί ί Ό ό Ύ ύ Ώ ώ   Α α Β β Γ γ Δ δ   Ε ε Ζ ζ Η η Θ θ   Ι ι Κ κ Λ λ Μ μ   Ν ν Ξ ξ Ο ο Π π   Ρ ρ Σ σ ς Τ τ Υ υ   Φ φ Χ χ Ψ ψ Ω ω   {{Polytonic|}}
Cyrillic: А а Б б В в Г г   Ґ ґ Ѓ ѓ Д д Ђ ђ   Е е Ё ё Є є Ж ж   З з Ѕ ѕ И и І і   Ї ї Й й Ј ј К к   Ќ ќ Л л Љ љ М м   Н н Њ њ О о П п   Р р С с Т т Ћ ћ   У у Ў ў Ф ф Х х   Ц ц Ч ч Џ џ Ш ш   Щ щ Ъ ъ Ы ы Ь ь   Э э Ю ю Я я   ́
IPA: t̪ d̪ ʈ ɖ ɟ ɡ ɢ ʡ ʔ   ɸ β θ ð ʃ ʒ ɕ ʑ ʂ ʐ ç ʝ ɣ χ ʁ ħ ʕ ʜ ʢ ɦ   ɱ ɳ ɲ ŋ ɴ   ʋ ɹ ɻ ɰ   ʙ ⱱ ʀ ɾ ɽ   ɫ ɬ ɮ ɺ ɭ ʎ ʟ   ɥ ʍ ɧ   ʼ   ɓ ɗ ʄ ɠ ʛ   ʘ ǀ ǃ ǂ ǁ   ɨ ʉ ɯ   ɪ ʏ ʊ   ø ɘ ɵ ɤ   ə ɚ   ɛ œ ɜ ɝ ɞ ʌ ɔ   æ   ɐ ɶ ɑ ɒ   ʰ ʱ ʷ ʲ ˠ ˤ ⁿ ˡ   ˈ ˌ ː ˑ ̪   {{IPA|}}

Your changes will be visible immediately.
  • For testing, please use the sandbox instead.
  • On talk pages, please sign your comment by typing four tildes (~~~~).

Please note:
  • If you don't want your writing to be edited mercilessly or redistributed by others, do not submit it.
  • Only public domain resources can be copied without permission — this does not include the vast majority of web pages or images.
  • See our policies and guidelines for more information on editing.

This page is a member of a hidden category: