Text Parsing with Regex

Hello Makers,

I need to extract info from these sample patterns that come in the subject line in email. These have a pattern such as always start with Have or Have but thereafter the information is not presented in exactly the same manner.

HAVE: Cessna Citation V(7 seats) Empty KBOS - KDAL on Jul 13 2024 [request id:8LI6HBLR0]
in this i need info in a collection with key value pairs as below

  1. Cessna Citation V
  2. 7
  3. KBOS
  4. KDAL
  5. Jul 13 2024

Some other examples :-
Have One Way KLEX-KAPF, Turboprop PAX8

HAVE: BNA-HPN 7/15 Heavy

HAVE: TODAY JAN-LAS Falcon 2000

I tried but could not make an expression that could fit all these input patterns.

Any help would be highly appreciated.

The term “regular” in regex is important. If you’re trying to extract the same information but you are presenting it differently every and there is semantic information associated with the data, it’s going to be very hard to do.

I’m looking at your data and this line:

HAVE: BNA-HPN 7/15 Heavy

Does it have 5 elements like the other ones? If so, what are they?

  1. Heavy
  2. 7 (or 15? or 7/15)
  3. BPA
  4. HPN
  5. Date (not in data, but I’m assuming it’s always there)

The only thing that seems regular in your pattern are the JAN-LAS and the date. Everything else… not sure.

L

If they are all in their own arbitary format, then you cannot use regular expressions.

Try using a form for the user to fill in, which outputs the same format everytime.

If you cannot control the input, then maybe you still can use OpenAI (Transform Text to Structured Data) module.

If you need further assistance, please provide the following:

  • at least 20 formatted examples (of the possible varying formats)

When reaching out for assistance with your regex pattern for a Text Parser module, it would be super helpful if you could format the actual text you’re trying to match. Screenshots of text can be a bit tricky, so if you could copy and paste the text directly here, that would be awesome! It ensures we can run it against test patterns effectively. If there’s any sensitive info, feel free to change it to something fictional yet still valid by keeping the format intact.

Providing clear text examples saves time on both ends and helps us give you the best possible solution. Without proper examples, we might end up playing a guessing game, and nobody wants that as it is a waste of time! You are more likely to get a correct answer faster. So, help us help you by sharing those text snippets.

Please format text in code blocks:

A. Type code fence manually
Either add three backticks ``` before and after the text, like this:

```
content goes here
```

B. Highlight and click the format button
Or use the format code button in the editor:
Screenshot_2023-10-02_191027

samliewrequest private consultation

Join the Make Fans Discord server to chat with other makers!