Advanced Search and Repace Question

  • I have an OPML export that contains a list of my subscribed podcasts. There are 127 entries and i’d like to strip away all the extraneous code and just keep my title list subscription names.

    I can’t seem to get the parameters right, and hope someone can help. Here is a sample.

        <outline text="Conversations with History (Audio)" type="rss" title="Conversations with History (Audio)" xmlUrl="" htmlUrl="" />
        <outline text="Common Sense with Dan Carlin" type="rss" title="Common Sense with Dan Carlin" xmlUrl="" htmlUrl="" />
        <outline text="Speaking of Jung: Interviews with Jungian Analysts" type="rss" title="Speaking of Jung: Interviews with Jungian Analysts" xmlUrl="" htmlUrl="" />

  • @bradsayers said:

    can’t seem to get the parameters right, and hope someone can help. Here is a sample.

    When asking for help, it’s considered polite to show what you’ve tried so far.

    Based on your description, I believe this will work.

    • Find = (?-s)^.*title="([^"]*)".*$
      • (?-s): don’t have . match newline
      • ^.*: match any characters near the beginning of the line
      • title=" must find that exact text
      • (^["]*) = find zero or more non-quote charcters after title=", and store in \0 (aka $0)
      • `".*$" = find the end-quote to the end of the line
    • Replace = $1
      • replace everything on that line (not including the newline characters) with what was in the title="..." (ie, what was stored in group $1)
    • Mode = regular expression

    For further regex information:

    If you have further search-and-replace (“matching”, “marking”, “bookmarking”, regular expression, “regex”) needs, study this FAQ and the documentation it points to. Before asking a new regex question, understand that for future requests, many of us will expect you to show what data you have (exactly), what data you want (exactly), what regex you already tried (to show that you’re showing effort), why you thought that regex would work (to prove it wasn’t just something randomly typed), and what data you’re getting with an explanation of why that result is wrong. When you show that effort, you’ll see us bend over backward to get things working for you. If you need help formatting, see the paragraph above.

    Please note that for all regex and related queries, it is best if you are explicit about what needs to match, and what shouldn’t match, and have multiple examples of both in your example dataset. Often, what shouldn’t match helps define the regular expression as much or more than what should match.

  • Peter that totally worked thanks! I would be embarrassed to note my attempts. I did read the help, learned a few things, but was unable to make the changes I was wanting - but you provided. Many thanks! Brad

  • @bradsayers

    I would be embarrassed to note my attempts

    never be embarrassed, we (usually) don’t bite ;-)

    anything possibly “embarrassing” we read, will also help us to adapt all guides, like the ones you’ve read, for future and inexperienced users,
    as we (definitively including me) sometimes take knowledge for granted, if we are not constantly fed with such information, and hence tend to forget the times when we started off as freshmen.

Log in to reply