• Resolved three_star_dave

    (@three_star_dave)


    I’m trying to do a replacement across a large number of Category Descriptions (in table *_term_taxonomy, field description). In trying to first search for what it would do, I have a regex phrase that should work (it works on regex101), identifying a range of numbers (e.g., “1825-1893”) somewhere in the description field with \d-\d) and I’ve specified Source “Terms,” filtered for Taxonomy Includes “Categories” … but it fails to match any rows.

    So I’m trying to figure out if I’m doing something wrong, or if I’m expecting Search Regex to do something it doesn’t do.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author John Godley

    (@johnny5)

    Could you include a screenshot? It’s hard to know exactly what you are doing

    Thread Starter three_star_dave

    (@three_star_dave)

    In my WP installation, where I track quotations, I am using Category to represent the quotation’s creator, with their name as the Category and a more full textual description, including their lifespan, in the Category Description.

    In giving a span of years, proper style is to use an en-dash (U+2013 or Alt-0150 in Windows) between the years, e.g., “World War 2 ran from 1939–1945”. But most of the 3400 entries use normal hyphens. 

    I am trying to replace those hyphens with en-dashes, cognizant that there are hyphens used in that same field that should remain that way. So using Regex to detect what should be affected makes the most sense. 

    “\d-\d” would seem to be the right parameter for that, and using it at Regex101.com with some pasted-in data:

    So it finds the date ranges items just fine when they have as hyphen. I have already manually replaced the hyphens with en-dashes for the Theodore Roosevelt’s entry, so it gets no hits. Note for the Montesquieu (last) entry, it properly picks up the hyphen in the date range, but not the one in the name “Charles-Lewis”.

    So I would expect the following in Search Regex to find these sorts of Category Description entries (table *_term_taxonomy, field description) as a Terms search — but … I get no matching results.

    So now I’m not sure whether I’m not using it properly, or if I’m asking it to do something it can’t do, or ???

    Thread Starter three_star_dave

    (@three_star_dave)

    I also get a null return if I use ” (?<=\d)-(?=\d) ” (with an eye toward substitution as the ultimate goal). This works as expected in Regex101/s test environment, but finds nothing in Search Regex.

    Plugin Author John Godley

    (@johnny5)

    Ok, it seems that term description is not included the search. I’m not sure why not, and it’s probably just an oversight.

    I’ve tracked it here: https://github.com/johngodley/search-regex/issues/226

    Thread Starter three_star_dave

    (@three_star_dave)

    Awesome, thanks.

Viewing 5 replies - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.