I won’t bore you with the basics of regex (there’s a website or two on that), but will simply describe it as a way to search for patterns in text, not just specific characters. This inability to do smart find-replace is a crying’ shame, and I’ve gnashed many a tooth over this quandary.Įnter regular expressions, aka regex or grep. So you can cycle through each year and each month, like I did, but that takes a fair amount of time as the number of texts grow. In the above example, trying to replace 170^# with 1704 will convert every year with 1704, even if it’s 1701 or 1702. But you can’t turn a variety of dates (text strings, mind you, not actual date data types) from MM/DD/YYYY into YYYY.MM.DD, because you need wildcards to find all the digit variations (, …), but you can’t keep those values found by wildcards when you try to move them into a different order. So, for example, you could easily convert all the forward slashes into periods, because you simply replace every slash with a period. That kind of search will return 1… But you’ve also undoubtedly been annoyed when you next learn that you can’t actually modify all those dates, because the wildcard character will be replaced in your basic find-replace with a single character. Entry-level text editing is easy enough: you undoubtedly learned long ago that in a text program like Microsoft Word you can find all the dates in a document – say and and – using a wildcard search like 170^#, where ^# is the wildcard for any digit (number). I’ll blame it on the fact that “digital humanities” wasn’t even a thing back then – check out Google Ngram Viewer if you don’t believe me. Twenty years later, I now discover that I could’ve shaved literally months off that work, if only I’d adopted the regex way of manipulating text. 1998-2000) when I was OCRing, proofing and manually parsing thousands of letters into my Access database? Well I sure do. Remember all those months in grad school (c. And now that I have, my mind is absolutely blown away. I’ve known about the concept of ‘regular expressions’ for years, but for some reason I never took the plunge. That’s it, TextWrangler will show you exactly which lines were modifed so you can easily copy them into your child theme’s style.css file.Seriously though. Highlight the 2 files you want to compare in the Documents drawer, right click on them and select the option ‘ Compare‘. This will open a sidebar with all opened documents.ģ. Open two documents (in my case, style.css in both the original and modified parent theme) that you’d like to compareĢ. Simply browsing through all the files would’ve taken ages, so this is where TextWrangler came in – this is how I did it at least:ġ. This is why I started working with child themes (more on those in my Learn page) and I finally decided to upgrade all of my older sites by building a child theme for each one of them. This prevented being able to update those themes as I would inevitably lose all changes. In my early WordPress days I started out by simply modifying existing themes (editing files such as style.css, header.php, footer.php, single.php, functions.php etc.). Recently, however, I discovered it’s also capable of comparing text files and highlighting the differences between them, plus it’s super easy to do it.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |