One day I want to meet a regular expression expert.

1. Extracting Flags

Flags often follow a specific pattern. For example, if flags are in the format FLAG{...}, you can use:

grep -o 'FLAG{[^}]*}' filename

This will match any text that starts with FLAG{ and ends with }

Use case:

Unminify

2. Finding Base64 Encoded Strings

Base64 encoded strings typically end with = or ==. You can use:

grep -Eo '[A-Za-z0-9+/]{4,}={0,2}' filename

This matches sequences of characters that are likely Base64 encoded.

3. Extracting IP Addresses

To find IP addresses in a file, use:

grep -Eo '([0-9]{1,3}\\.){3}[0-9]{1,3}' filename

This matches patterns that look like IPv4 addresses.

4. Extracting Email Addresses

To find email addresses, use:

grep -Eo '[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}' filename

This matches common email address formats.

5. Finding URLs