Skip to main content
All CollectionsFilters
How to Use Regular Expression (Regex) to Filter RSS Feeds
How to Use Regular Expression (Regex) to Filter RSS Feeds
Updated over 2 months ago

Regex (Regular Expressions) filters are a powerful way to customize your feeds by including or excluding content based on specific patterns. Here’s a step-by-step guide to help you effectively use regex filters in RSS.app based on common use cases:

1. Understanding Regex Filters

Regex filters allow you to:

  • Include specific posts: Show only posts that match certain patterns.

  • Exclude specific posts: Hide posts that match certain patterns.

  • Modify feed content dynamically: Match patterns in titles, descriptions, or other fields.

Regex Operators and Syntax Table

Operator/Syntax

Description

Example

Explanation

.

Matches any single character except a newline.

a.b

Matches aab, acb, but not ab or a\nb.

*

Matches 0 or more repetitions of the preceding element.

ab*

Matches a, ab, abb, abbb.

+

Matches 1 or more repetitions of the preceding element.

ab+

Matches ab, abb, abbb, but not a.

?

Matches 0 or 1 repetition of the preceding element.

colou?r

Matches color or colour.

`

`

OR operator (matches either pattern).

`cat

^

Matches the start of a string.

^Hello

Matches Hello only at the beginning of the string.

$

Matches the end of a string.

world$

Matches world only at the end of the string.

[]

Matches any one character in the brackets.

[abc]

Matches a, b, or c.

[^]

Matches any one character not in the brackets.

[^abc]

Matches any character except a, b, or c.

()

Groups expressions. Used for capturing.

(ab)+

Matches ab, abab, ababab. Captures each repetition.

{n}

Matches exactly n repetitions.

a{3}

Matches aaa.

{n,}

Matches n or more repetitions.

a{2,}

Matches aa, aaa, aaaa, etc.

{n,m}

Matches between n and m repetitions.

a{2,4}

Matches aa, aaa, or aaaa.

\

Escapes a special character.

\.

Matches the literal . character.

\d

Matches any digit (0–9).

\d+

Matches 123, 456, etc.

\D

Matches any non-digit.

\D+

Matches abc, @#$, etc.

\w

Matches any word character (letters, digits, underscore).

\w+

Matches hello, word_1, etc.

\W

Matches any non-word character.

\W+

Matches @#$, (space), etc.

\s

Matches any whitespace character.

\s+

Matches spaces, tabs, or newlines.

\S

Matches any non-whitespace character.

\S+

Matches words or symbols, but not spaces.


2. Common Use Cases

Remove Unwanted Characters or Text

If you want to remove specific parts of a title or description, use a regex pattern.

Example:

  • Pattern: ^(.*?)\s—.*

  • Result: Matches the first part of a title before the symbol and removes everything after it.

  • Use Case: Clean titles like Breaking News — World Updates to only show Breaking News.


Whitelist Specific Keywords

Include posts that contain specific words or phrases.

Example:

  • Pattern: .*(AI|Machine Learning|Data Science).*

  • Result: Matches posts containing AI, Machine Learning, or Data Science.

  • Use Case: Curate a feed with only tech-related content.


Blacklist Specific Keywords

Exclude posts with unwanted words or phrases.

Example:

  • Pattern: .*(Sports|Celebrity|Gossip).*

  • Result: Hides posts containing Sports, Celebrity, or Gossip.

  • Use Case: Avoid non-business-related content.


Filter by URL or Domain

Use regex to include or exclude posts from specific domains.

Example:

  • Pattern: .*example\.com.*

  • Result: Filters posts that mention example.com in the URL.

  • Use Case: Target posts from a specific website.


Match Specific Date Formats

Include or exclude posts based on date formats.

Example:

  • Pattern: \d{4}-\d{2}-\d{2}

  • Result: Matches a date format like 2024-12-31.

  • Use Case: Focus on posts with structured date formats.


3. How to Apply Regex Filters

  1. Navigate to the feed/bundle filters you want to apply the filter to.

  2. Go to Replace or Remove and Add Replace/Remove rule

  3. Enable Regular expression by clicking on .*

  4. Add Regex Pattern: .*example\.com.*


4. Tips

  • Use tools like Regex101 to validate your regex patterns before applying them.

  • Begin with basic patterns and refine as you understand how they affect your feed.

  • If you're having trouble creating a regex pattern, you can use AI tools like ChatGPT to assist you. Simply describe what you're trying to filter or match, and it can generate the necessary regex filter for you. For example, you can ask:

    • "Create a regex pattern to match titles containing the words 'AI' or 'Machine Learning'."

    • "Generate a regex to exclude URLs containing 'example.com'."


5. Troubleshooting

  • Double-check your regex syntax and ensure it matches the target content.

  • Ensure no conflicting filters are applied.


6. Example Scenarios

Replace specific hashtags with a keyword

  • Use case: Replace "#AI" and "#MachineLearning" with "Technology".

  • Filter type: Replace

  • Regex: #(AI|MachineLearning)

Replace emoji with text

  • Use case: Replace all emojis with the text [EMOJI].

  • Filter type: Replace

  • Regex: [^\w\s,.!?]

Replace certain text patterns

  • Use case: Replace "Breaking News:" with "[Updated]".

  • Filter type: Replace

  • Regex: ^Breaking News:

Replace company name in titles

  • Use case: Replace "RSS.app" with "Our Service".

  • Filter type: Replace

  • Regex: RSS\.app

Remove text after a specific delimiter

  • Use case: Remove everything after a "—" in a title.

  • Filter type: Remove

  • Regex: —.*

Remove URLs from content

  • Use case: Remove all URLs from feed descriptions.

  • Filter type: Remove

  • Regex: https?://[^\s]+

Remove special characters

  • Use case: Remove all non-alphanumeric characters except spaces.

  • Filter type: Remove

  • Regex: [^a-zA-Z0-9\s]

Remove titles starting with specific keywords

  • Use case: Remove all posts with titles starting with "Promo" or "Ad".

  • Filter type: Remove

  • Regex: ^(Promo|Ad).*

Remove trailing hashtags

  • Use case: Remove hashtags at the end of a title.

  • Filter type: Remove

  • Regex: \s#[\w]+$

Remove numbers from text

  • Use case: Remove all digits from descriptions.

  • Filter type: Remove

  • Regex: \d+

Did this answer your question?