Sample Regular Expressions: Difference between revisions

From Simple Wiki
No edit summary
No edit summary
 
Line 1: Line 1:
You can find different sample Regular Expressions that can be used in the SimpleIndex template for matching below.
You can find different sample Regular Expressions that can be used in the SimpleIndex template for matching below.


==== Sample 1 ====
=== Sample 1 ===
'''Description:''' If you want to read every character after a certain tag or combination of tags until a line feed.<br>
'''Description:''' If you want to read every character after a certain tag or combination of tags until a line feed.<br>
'''Scenario:'''  Read everything after "Job: or Job # or Job"<br>
'''Scenario:'''  Read everything after "Job: or Job # or Job"<br>
'''RegEx:'''  (?<=(Job:|Job #|Job)).+
'''RegEx:'''  (?<=(Job:|Job #|Job)).+


==== Sample 2 ====
=== Sample 2 ===
'''Description:''' If you want to read every character after a certain tag or combination of tags until it reads another tag.<br>
'''Description:''' If you want to read every character after a certain tag or combination of tags until it reads another tag.<br>
'''Scenario:'''  Read everything after "Job: or Job # or Job" until "Ticket #"<br>
'''Scenario:'''  Read everything after "Job: or Job # or Job" until "Ticket #"<br>
'''RegEx:'''  (?<=(Job:|Job #|Job)).+(?=Ticket #)
'''RegEx:'''  (?<=(Job:|Job #|Job)).+(?=Ticket #)

Latest revision as of 16:11, 13 April 2023

You can find different sample Regular Expressions that can be used in the SimpleIndex template for matching below.

Sample 1[edit | edit source]

Description: If you want to read every character after a certain tag or combination of tags until a line feed.
Scenario: Read everything after "Job: or Job # or Job"
RegEx: (?<=(Job:|Job #|Job)).+

Sample 2[edit | edit source]

Description: If you want to read every character after a certain tag or combination of tags until it reads another tag.
Scenario: Read everything after "Job: or Job # or Job" until "Ticket #"
RegEx: (?<=(Job:|Job #|Job)).+(?=Ticket #)