TestRegEx : Différence entre versions

De MicMac
Aller à : navigation, rechercher
(Création de la page : un début...)
 
(Ajout tableau exemple RegEx)
 
Ligne 5 : Ligne 5 :
 
===Regular Expressions===
 
===Regular Expressions===
 
Regular expressions (RegEx) are a sequence of characters that define a search pattern.
 
Regular expressions (RegEx) are a sequence of characters that define a search pattern.
 +
 +
{| class="wikitable"
 +
|+Pattern for regular expressions
 +
!scope=col|RegEx
 +
!scope=col|Description
 +
|-
 +
| <pre>[abc]</pre> || A single character of a, b or c
 +
|-
 +
| <pre>[^abc]</pre> || A character, except a, b or c
 +
|-
 +
| <pre>[a-z]</pre> || A character in the range: a-z
 +
|-
 +
| <pre>[^a-z]</pre> || A character not in the range: a-z
 +
|-
 +
| <pre>[a-zA-Z]</pre> || A character in the range: a-z or A-Z
 +
|-
 +
| <pre>.</pre> || Any single character
 +
|-
 +
| <pre>\s</pre> || Any whitespace character
 +
|-
 +
| <pre>\S</pre> || Any non-whitespace character
 +
|-
 +
| <pre>\d</pre> || Any digit
 +
|-
 +
| <pre>\D</pre> || Any non-digit
 +
|-
 +
| <pre>\w</pre> || Any word character
 +
|-
 +
| <pre>\W</pre> || Any non-word character
 +
|-
 +
| <pre>(...)</pre> || Capture everything enclosed
 +
|-
 +
| <pre>(a|b)</pre> || Match either a or b
 +
|-
 +
| <pre>a?</pre> || Zero or one of a
 +
|-
 +
| <pre>a*</pre> || Zero or more of a
 +
|-
 +
| <pre>a+</pre> || One or more of a
 +
|-
 +
| <pre>a{3}</pre> || Exactly 3 of a
 +
|-
 +
| <pre>a{3,}</pre> || 3 or more of a
 +
|-
 +
| <pre>a{3,6}</pre> || Between 3 and 6 of a
 +
|-
 +
| <pre>^</pre> || Start of string
 +
|-
 +
| <pre>$</pre> || End of string
 +
|-
 +
| <pre>\b</pre> || A word boundary
 +
|-
 +
| <pre>\B</pre> || Non-word boundary
 +
|}
 +
  
 
===Syntax===
 
===Syntax===

Version actuelle en date du 27 juillet 2018 à 15:59

Picto-liste.png List of commands

Description

TestRegEx is a tool that allows you to test a regular expression.

Regular Expressions

Regular expressions (RegEx) are a sequence of characters that define a search pattern.

Pattern for regular expressions
RegEx Description
[abc]
A single character of a, b or c
[^abc]
A character, except a, b or c
[a-z]
A character in the range: a-z
[^a-z]
A character not in the range: a-z
[a-zA-Z]
A character in the range: a-z or A-Z
.
Any single character
\s
Any whitespace character
\S
Any non-whitespace character
\d
Any digit
\D
Any non-digit
\w
Any word character
\W
Any non-word character
(...)
Capture everything enclosed
(a|b)
Match either a or b
a?
Zero or one of a
a*
Zero or more of a
a+
One or more of a
a{3}
Exactly 3 of a
a{3,}
3 or more of a
a{3,6}
Between 3 and 6 of a
^
Start of string
$
End of string
\b
A word boundary
\B
Non-word boundary


Syntax

The global syntax for TestRegEx is:

mm3d TestRegEx Pattern NamedArgs

Help

You can access to the help by typing :

mm3d TestRegEx -help


*****************************
*  Help for Elise Arg main  *
*****************************
Mandatory unnamed args :
  * string :: {Pattern of files}
Named args :
  * [Name=DispPat] bool :: {Display Pattern to use in cmd line ; Def=false}
  * [Name=ExpList] string :: {Export list image in text file ; Def=false}


Example

Let the following set of images :

IMG_4167.JPG
IMG_4168.JPG
IMG_4169.JPG
IMG_4170.JPG
IMG_4171.JPG
IMG_4172.JPG
IMG_4173.JPG
IMG_4174.JPG
IMG_4175.JPG
IMG_4176.JPG
IMG_4177.JPG
IMG_4178.JPG
IMG_4179.JPG
IMG_4180.JPG
If you want to select only images IMG_4170.JPG, IMG_4171.JPG and IMG_4172.JPG, you can type:
"IMG_417[0-2].JPG"
If you want to select all the images, you can type:
".*JPG"