Hi,
When I want to add a small numer of pictures by editing in XML, I do it manually, but sometimes I need to add many pictures, therefore I need to find a quicker way.
Does anybody know how to edit the numbering in the strings?
For example:
<segment-item src="C:\My Photos\2003_07_Lucca\MPEG_07_Lucca\2003_07_Lucca_0 01_FIRST.mpg" id="Segment-0691"/>
I need to add 99 pictures, therefore both the 001 and 691 will have to be increased sequencially.
How can I copy/paste such a string in order to have the numbering changed to 002 - 692, 003 - 693 etc? using Excel or any other tool?
Thank you for your valuable help.
Alex![]()
Results 1 to 4 of 4
-
-
A good text editor like Textpad can use regular expressions to increment numbers in a "search and replace" operation. MS Word macros can use regular expressions, I think. I don't use Excel much, so I'm not sure what language it might use. Being a spreadsheet, I'm sure you can operate on numbers with it some way or another. If you use a regular expression, the tricky part is writing it.
For example, a regular expression to update sequence numbers of the form Axxx, Bxxx, … ,Zxxx where "xxx" is any number >= 100, independent of the letters, which are to be preserved:
Search for:\([A-Z]\)[1-9][0-9][0-9]+
Replace with:\1\i(100)
-
Ebenton,
Yes, I have seen that there is the possibility to do this in both Word and Excel, but I cannot find the meaning of some symbols like:
\
i
The Help of MS is never that clear you know...
In order to make a bit easier for me to understand, can you use the sample that I included in my first mail and write the Search for/Replace in order to create the sequence 002, 003 etc. as well as 0691, 0692 etc.
Just tell me the meaning of the symbols you use in TextPad and I will try to identify them in Word or Excel.
Thank you for your help and patient.
Alex
-
These examples might work:
Search for: \(segment-\)[0-9][0-9][0-9]+
Replace with: \1\i(692)
Then for the Lucca_001 part,
Search for: \(Lucca_\)[0-9][0-9][0-9]+
Replace with: \1\i(002)
You will lose the leading zeros with this second one. I don't remember how to force the leading zeros. But at least you only have to add them up to 99.
How to Use Regular Expressions
A regular expression (RE) is a search string that uses special characters to match patterns of text. You can use them with the Find, and Find in Files commands, and with the Replace command in conjunction with replacement expressions. TextPad's regular expressions are based on POSIX standard P1003.2, but the syntax can be that of POSIX, or UNIX extended regular expressions (the default). The choice can be made on the Editor page of the Preferences dialog box.
To use a regular expression:
From the Search menu, choose Find, Replace, or Find in Files.
In the Find What box, type a regular expression.
Check the "Regular expression" box.
Summary of regular expressions:
Default Operator: POSIX Operator: Description:
. . Any single character. Example: h.t matches hat, hit, hot and hut.
[ ] [ ] Any one of the characters in the brackets, or any of a range of characters separated by a hyphen (-), or a character class operator (see below). Examples: h[aeiou][a-z] matches hat, hip, hit, hop, and hut; [A-Za-z] matches any single letter; x[0-9] matches x0, x1, …, x9.
[^] [^] Any characters except for those after the caret "^". Example: h[^u]t matches hat, hit, and hot, but not hut.
^ ^ The start of a line (column 1).
$ $ The end of a line (not the line break characters). Use this for restricting matches to characters at the end of a line. Example: end$ only matches "end" when it's the last word on a line, and ^end only matches "end" when it's the first word on a line.
\< \< The start of a word.
\> \> The end of a word.
\t \t The tab character.
\f \f The page break (form feed) character.
\n \n A new line character, for matching expressions that span line boundaries. This cannot be followed by operators '*', '+' or {}. Do not use this for constraining matches to the end of a line. It's much more efficient to use "$".
\xdd \xdd "dd" is the two-digit hexadecimal code for any character.
\( \) ( ) Groups a tagged expression to use in replacement expressions. An RE can have up to 9 tagged expressions, numbered according to their order in the RE. The corresponding replacement expression is \x, for x in the range 1-9. Example: If \([a-z]+\) \([a-z]+\) matches "way wrong", \2 \1 would replace it with "wrong way".
* * Matches zero or more of the preceding characters or expressions. Example: ho*p matches hp, hop and hoop.
? ? Matches zero or one of the preceding characters or expressions. Example: ho?p matches hp, and hop, but not hoop.
+ + Matches one or more of the preceding characters or expressions. Example: ho+p matches hop, and hoop, but not hp.
\{count\} {count} Matches the specified number of the preceding characters or expressions. Example: ho\{2\}p matches hoop, but not hop.
\{min,\} {min,} Matches at least the specified number of the preceding characters or expressions. Example: ho\{1,\}p matches hop and hoop, but not hp.
\{min,max\} {min,max} Matches between min and max of the preceding characters or expressions. Example: ho\{1,2\}p matches hop and hoop, but not hp or hooop.
\| | Matches either the expression to its left or its right. Example: hop\|hoop matches hop, or hoop.
\ \ "Escapes" the special meaning of the above expressions, so that they can be matched as literal characters. Hence, to match a literal "\", you must use "\\". Example: \< matches the start of a word, but \\< matches "\<".
Character Class Operators "[: ... :]":
These can be used in class expressions as an alternative way of representing classes of characters. For example, [a-z0-9] is equivalent to [[:lower:][:digit:]]. (Note the extra pairs of brackets.) The defined classes are:
Expression: Description:
[:alpha:] Any letter.
[:lower:] Any lower case letter.
[:upper:] Any upper case letter.
[:alnum:] Any digit or letter.
[:digit:] Any digit.
[digit:] Any hexadecimal digit (0-9, a-f or A-F).
[:blank:] Space or tab.
[pace:] Space, tab, vertical tab, return, line feed, form feed.
[:cntrl:] Control characters (Delete and ASCII codes less than space).
[rint:] Printable characters, including space.
[:graph:] Printable characters, excluding space.
[unct:] Anything that is not a control or alphanumeric character.
[:word:] Letters, hypens and apostrophes.
[:token:] Any of the characters defined on the Syntax page for the document class, or in the syntax definition file if syntax highlighting is enabled for the document class.
Example:
HTML tags are in matched pairs of <…>, such as <FONT SIZE=+1>. To match any tag that begins and ends on the same line, use the regular expression:
<[^>]*>
This matches a "<", followed by zero or more characters, excluding ">", followed by a ">". Note that "*" finds the longest matching sequence on a line, so the regular expression:
<.*>
would be incorrect, because it would not stop at the first ">", if there was more than one on the line.
Similar Threads
-
Edit a video with Sony Vegas show a sunset and clounds pass very quick
By siopilos in forum EditingReplies: 9Last Post: 2nd Jun 2011, 16:33 -
CLI to XML
By eon_designs in forum Video ConversionReplies: 1Last Post: 29th Apr 2010, 10:50 -
Strings sound like crap on Youtube
By brassplyer in forum Video Streaming DownloadingReplies: 4Last Post: 12th Aug 2009, 23:38 -
DriveImage XML
By blockie@sbcglobal.ne in forum ComputerReplies: 2Last Post: 25th Jul 2008, 16:25 -
Non-gaming "tight purse strings" build Opinions?
By louv68 in forum ComputerReplies: 11Last Post: 16th May 2007, 12:04