RegEX question

Hi,

I am trying to write a regex for myscript and need some input from experts.

here is what I must grep for

TICKET{Sapce}[3,4,5.. digit number][a comma]{Space}[Two aplhabits]{hyphen}[3,4,5 ..digit number][colon][some text]

so here is the example data

TICKET 34554, CT-12345, TICKET 12345: some text here

TICKET 2342, CT-12345, MA-12344: some text here

TICKET 2345, TICKET 2345, TICKET 2345: some text here

every line starts with TICKET ####

I tried a bit but not able to cover case so far. Please suggest

Not all you tickets look like that, then. Only some of them have tags like MA-.

Of all that input data, what do you actually want out?

What output do you expect ?

PCRE.

/^TICKET [0-9]{4,5}, (CT-[0-9]{4,5}|TICKET [0-9]{4,5}|MA-[0-9]{4,5}), (CT-[0-9]{4,5}|TICKET [0-9]{4,5}|MA-[0-9]{4,5}): .+$/

yeah, not all tickets will have same pre text . I have TICKETS 2 formats

TICKET numbers
or
CODE-Number i.e AP-12345

Out: I need a regex to find this format.

---------- Post updated at 08:12 PM ---------- Previous update was at 08:10 PM ----------

I am trying to search a file to pick up lines of the given data format. In other words I need a regex that can find lines like above given format.

/^TICKET [0-9]{4,5}, ([A-Z]{2}-[0-9]{4,5}|TICKET [0-9]{4,5}|[A-Z]{2}-[0-9]{4,5}), ([A-Z]{2}-[0-9]{4,5}|TICKET [0-9]{4,5}|[A-Z]{2}-[0-9]{4,5}): .+$/
1 Like