Showing results for regular expressions - Scripting Blog [archived]

Feb 28, 2008
Post comments count0
Post likes count0

Hey, Scripting Guy! How Can I Move Files Based on a Portion of the File Name?

ScriptingGuy1
ScriptingGuy1

Hey, Scripting Guy! I have tens of thousands of files that all have a file name that includes a number bounded by two underscore characters; for example, P_19_L00.jpg. I need to figure out which number is embedded in a file name, then move that file to a folder named after that number. In this case, that means moving P_19_L00.jpg to the folder D:\...

Scripting Guy!scripting techniquesVBScript
Feb 22, 2008
Post comments count0
Post likes count0

Hey, Scripting Guy! How Can I Replace Incorrect Dates in My File Names?

ScriptingGuy1
ScriptingGuy1

Hey, Scripting Guy! have a folder that has a whole bunch of files in it. Many of those files have a file name that includes an incorrect date; for example, the file might be named FGA Site Visit 2-14-07 204.jpg when it should really be named FGA Site Visit 2-14-08 204.jpg. (That is, it suggests the visit occurred in 2007 rather than 2008.) How can...

Scripting Guy!scripting techniquesVBScript
Feb 18, 2008
Post comments count0
Post likes count0

Hey, Scripting Guy! How Can I Extract Three-Digit Numbers From a String?

ScriptingGuy1
ScriptingGuy1

Hey, Scripting Guy! I’m trying to use regular expressions to extract three-digit numbers that are enclosed by pipe characters; they embedded in string values like this: |159|468|572|843|. However, I can’t figure out the syntax that will get this to work. Can you help me?-- RS Hey, RS. Before we answer this question we should note that...

Scripting Guy!scripting techniquesVBScript
Sep 28, 2006
Post comments count0
Post likes count0

How Can I Locate Strings That Consist of a Series of Numbers Followed by .ZIP?

ScriptingGuy1
ScriptingGuy1

Hey, Scripting Guy! I have a file which includes a number of file names. All of these names consist of a series of numbers followed by a .zip file extension; for example, 1234.zip, 5678.zip, etc. How can I write a script that locates all these file names and then saves just the names to a second file?-- RS Hey, RS. You know, numbers are very imp...

Scripting Guy!scripting techniquesVBScript
Sep 20, 2006
Post comments count0
Post likes count0

How Can I Verify That All the Characters in a String are Either A-to-Z (Uppercase Letters) or the Digits 0-through-9 in a HTA?

ScriptingGuy1
ScriptingGuy1

Hey, Scripting Guy! In an HTA, how can I verify that all the characters are either A-to-Z (uppercase letters) or the digits 0-through-9?-- MB Hey, MB. You want to talk irony? Oh. Well, we’re going to talk irony anyway. In yesterday’s column we tried to be cute, posing as the illegitimate children of a non-existent defense minister and trying to ...

Scripting Guy!scripting techniquesVBScript