Skip to content

Instantly share code, notes, and snippets.

@bepcyc
Created April 26, 2023 09:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bepcyc/3a0efca38a8f19b4ea58ba67a3cd960c to your computer and use it in GitHub Desktop.
Save bepcyc/3a0efca38a8f19b4ea58ba67a3cd960c to your computer and use it in GitHub Desktop.
regex expressions used by me for dumping DPreview forum discussions and reducing their size
1. Removing quotes and nested quotes: ^ {4}(\w+ wrote:(?:\n+(?: {4,}.*))*)
This will match quotes likes this one:
```
user1 wrote:
user2 wrote:
I use Lens X on Camera Y. It's a super good combo. I have bought the lens station on Amazon. Upgraded to latest firmware and I have full ibis now.
I just got my 85mm and it does not work well on my Camera W. As others have noted, IBIS and BB+ shooting does not work.
Anyone else have issues with continuous AF?
Update: I received the lens station today.
```
"Update ..." string will not be part of a match.
2. Removing "user's gear list" part: (?P<username>[\w']+)\'s gear list:\n((?P<gear>[^\n]+)\n)*?\w+ • \w+ Member • Posts: \d+(?=\n|$)
This will match sections like this one:
```
user5's gear list:
Camera 1 Camera 2 Camera 3 Lens 1 Lens 2 Lens 3 Useless expensive thing 100 +4 more
someword • Regular Member • Posts: 317
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment