![]() + sequence means that one or more characters should appear between them. ![]() The beginning s and ending n are interpreted literally, while the. This short regular expression represents, or matches in regex parlance, the Artist component: s.+n Using this consistency, we can put together a combination of literal characters and one or more character classes to match the pattern or convention our file names adhere to. Perusing our examples, we can see that the Artist component of each file name begins with the letter s and ends with the letter n. Indeed, the trick to writing regular expressions for file renaming is to find and exploit consistencies in our file names. If we consistently use a standard separator between file name components when naming files, such as the space-hyphen-space sequence used in our example file names, we can rely on this consistency, in many cases, to make our file renaming tasks much easier. In a regular expression, the period represents a single instance of any character except the invisible end-of-line characters. One of the most useful of these character classes - especially for quick-and-dirty file renaming operations - is the humble period (.). But there is a small number of reserved characters and other notations called character classes that each represent a specific character type, and this is where the power of a regular expression lies. A regular expression processor interprets most characters literally. Regular expressions feature rules that specify how to represent characters and - more importantly - character types. Let’s use these file names as examples: Stevie Ray Vaughan - Pride and Joy.aac Stevie Rya Vaughan - Texas Flood.aac Steve Ray Vaughan - Couldn’t Stand the Weather.aac Stevey Ray Vaughn - Lenny.aac Stevie Ray Vaughn - Call It Stormy Monday.aacĪs you can see, only one of these files features the artist’s correctly spelled last name. A Better Finder Rename’s Replace regular expression action makes it easy to standardize the spelling among these files. As sometimes happens, many of the tracks feature misspellings of Stevie’s last name, which can be a real pain in the neck. Let’s say we have a number of songs by Texas blues legend Stevie Ray Vaughan. Using this regular expression, we can then tell A Better Finder Rename to replace a certain part of the file name with something else or completely rearrange the components of the file name to form a new file naming convention. Using a regular expression creates what amounts to a template describing a file naming convention, and can potentially identify a large number of files - all the photos taken during a particular event, for instance - in a given collection.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |