Examples of expression matching

Example Description
^(Invoice[a-z]*[1-9]+)$ Matches all subjects that start with the word "Invoice", followed by 0 or more characters, followed by at least one numeric digit, and no other characters after it.
  • Therefore, possible matches are:
  • Invoice2
  • InvoiceForShipment23

This expression will not match the following: ShipmentInvoices, ShipmentInvoices34, ShipmentInvoices34A, Invoice, InvoiceA2B.

(Invoice[a-z]*[1-9]+)

Matches all subjects that contain the word "Invoice", followed by 0 or more characters, followed by at least one numeric digit.

Therefore, possible matches are:

  • Invoice2
  • ShipmentInvoices34
  • ShipmentInvoices34A
  • InvoiceA2B
  • InvoicesForShipment23

This component will not match the following: ShipmentInvoice, ShipmentInvoices (because it still requires at least one numeric digit following Invoice [a-z]* )

([123]+[^a-c](start|end)+)$

Matches all subjects that begin with any set of characters, followed by at least one occurrence of 1, 2, 3, followed by only one letter not in the range a-c, followed by the word "start" or "end" one or more times, and no other characters following it.

Therefore, possible matches are:

  • Invoice23Mendstartend
  • Invoice12Send
  • SimpleInvoice1d

This component will not match the following: mEnd (because there is no starting matching sequence with 1, 2, or 3), 1mstartFile (because no characters should follow the word “end”/ “start”), or 1start (because there is no character in between “1” and “start” that is in the range of c-z ).