Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

...

...

Include Page
TERMS:Regular Expression (RegEx)
TERMS:Regular Expression (RegEx)

Online tool to test & validate regular expressions: www.regexr.com

  • Make sure PCRE is selected in the top right corner

  • Switch between Details and Explain tab

...

Widget Connector
overlayyoutube
_templatecom/atlassian/confluence/extra/widgetconnector/templates/youtube.vm
width400px
urlhttps://www.youtube.com/watch?v=rhzKDrUiJVk
height300px

Get specific product code from

...

the filename

The product code must be at the beginning and must be 14 characters long. 

Check Filename of Image, Get Product Code and Store in "parsed_filename" Variable
Code Block
title
(?<productCode>^(F-|G-|V-)[^_]*?)_()

...

Get any type of product code from the original filename

...

RegEx
Code Block
title
(?<productCode>^[0-9]{2} [0-9]{3} [^-]*)-(?<filename>.*)

Short Explanation: 

  • Create a group "productCode"

  • Start a the beginning ^

  • Get the first two numbers

  • Get the next three numbers

  • Get the rest until you find a dash - 

Input

Original File name

01 747 7715 7754-Set_HighRes_4035.jpg

Output

productCode (from Regular Expression)

01 747 7715 7754

Output

filenmae (from Regular Expression)

Set_HighRes_4035.jpg

...

Get code that starts with MT-

Code Block
(?:MT|\G)-(?<mediaType>[A-Z\s]{3,4})

Short Explanation: 

  • Create a group "mediaType"

  • Get a code that starts with MT

Input

Original File name

Summer-Campaign_MT-EMOS-Set_HighRes_4035.jpg

Output

mediaType (from Regular Expression)

MT-EMOS