The Palos Publishing Company

Follow Us On The X Platform @PalosPublishing
Categories We Write About

Parse online booking confirmation details

To parse online booking confirmation details effectively, you typically need to extract structured data such as:

  • Booking ID / Reference Number

  • Customer Name

  • Date of Booking

  • Check-in / Check-out Dates (for hotels) or Departure/Return Dates (for flights)

  • Location / Destination

  • Service Type (e.g., flight, hotel, car rental)

  • Total Cost

  • Payment Status

  • Contact Information

  • Cancellation Policy

Here’s how you can approach parsing this data depending on your source:


1. From Text (Emails, PDFs, HTML):

Use regular expressions or natural language processing to extract key-value pairs. For example:

python
import re text = """Booking Confirmation Reference: ABC12345 Name: John Doe Hotel: Grand Bay Resort Check-in: July 15, 2025 Check-out: July 20, 2025 Total: $1,200.00 Status: Confirmed """ booking_info = { "reference": re.search(r"Reference:s*(S+)", text).group(1), "name": re.search(r"Name:s*(.+)", text).group(1), "hotel": re.search(r"Hotel:s*(.+)", text).group(1), "check_in": re.search(r"Check-in:s*(.+)", text).group(1), "check_out": re.search(r"Check-out:s*(.+)", text).group(1), "total": re.search(r"Total:s*(.+)", text).group(1), "status": re.search(r"Status:s*(.+)", text).group(1) } print(booking_info)

2. From Structured JSON or API Response:

If you’re working with an API like Booking.com, Expedia, or airline APIs, you’ll usually get a JSON response:

json
{ "booking_id": "XYZ98765", "customer_name": "Alice Smith", "service": "Flight", "departure_date": "2025-08-10", "return_date": "2025-08-20", "origin": "LAX", "destination": "JFK", "price": 650.00, "currency": "USD", "status": "Confirmed" }

You can directly parse this in Python or JavaScript using standard parsing libraries like json.loads().


3. Email Parsing Tools (Optional for Automation):

Use tools like:

  • IMAP + Python (e.g., imaplib, email.parser) for parsing booking emails.

  • Zapier or Make to auto-parse and push data to a CRM or Google Sheet.

  • Cloud-based services like Mailparser.io or Parsio.io for non-coders.


4. From HTML Pages (Web Scraping):

Use BeautifulSoup (Python):

python
from bs4 import BeautifulSoup html = '''<div><span id="booking-id">Booking ID: ABC123</span></div>''' soup = BeautifulSoup(html, 'html.parser') booking_id = soup.find('span', id='booking-id').text.split(":")[1].strip()

Tips:

  • Normalize date formats to YYYY-MM-DD.

  • Convert prices to a consistent currency if needed.

  • Validate extracted fields (e.g., is the reference number alphanumeric?).

  • Handle edge cases like missing data or split confirmation sections.

If you have a sample confirmation (text, HTML, JSON, etc.), I can help build a custom parser.

Share this Page your favorite way: Click any app below to share.

Enter your email below to join The Palos Publishing Company Email List

We respect your email privacy

Categories We Write About