I need help you rename a file using regular expressions in Bridge.

Hello

I work at a University, and we are working through files for our theses and Dissertations. We were renamed to make them more coherent. I wonder if there is a regular expression that could help in this process?

Examples come from current file names;

  • THESIS H343G 1981
  • Thesis of 1981 g996e
  • THESIS-1981-A543G

I just need to change the actual file names. how they are formatted.

Where appropriate on the thesis.

Hyphens (-) in all white space.

First letter, last letter is lower case on appeal no (H343g)

If the list above should look like;

  • Thesis-1981-H343g
  • Thesis-1981-G996e
  • Thesis-1981-A543g

I've seen people do some pretty cool things with regular expressions! Any help would be greatly appreciated. Thank you!

You would be better to use a script to do this as an example because I don't think it would be possible in the new name of bridge.

Using ExtendScript Toolkit or a text editor to copy the code in any event and save it to sub Filename.jsx

This must be recorded in the appropriate folder. It is located by going to preferences in Bridge, select Startup Scripts, this will open the folder where the script should be saved.

Once this is done close and restart Bridge.

Usage: Goto the Tools Menu and select Rename PDF files

Be sure to only test the code with some files copied to a separate first folder to make sure it's what you want.

The script will make all PDF files in the selected folder.

#target bridge
if( BridgeTalk.appName == "bridge" ) {
renamePDFs = MenuElement.create("command", "Rename PDFs", "at the end of Tools");
}
renamePDFs.onSelect = function () {
app.document.deselectAll();
var thumbs = app.document.getSelection("pdf");
for( var z in thumbs){
var Name = decodeURI(thumbs[z].spec.name);
var parts = Name.toLowerCase().replace(/\s/g,'-').match(/(.*)(-)(.*)(-)(.*)(\.pdf)/);
var NewName = parts[1].replace(/^[a-z]/, function(s){ return s.toUpperCase() });
NewName += parts[2]+parts[3]+parts[4]+parts[5].toUpperCase().replace(/[A-Z]$/, function(s){ return s.toLowerCase() });
NewName += parts[6];
thumbs[z].spec.rename(NewName);
    }
};

Tags: Bridge

Similar Questions

  • Using regular expressions to solve sys_refcursor of a record

    Regarding my Question about sys_refcursor with record type of thread, I thought it can be solved differently. It is:

    I have a string like ' 8:1706, 1194, 1817 ~ 1:1217, 1613, 1215, 1250'

    I need to do a few things using regular expressions and get something like
    select * from <table> where
    c1 in (8,1)
    and c2 in (1706,1194,1817,1217,1613,1215,1250);
    Is it possible by using regular expressions in a single select statement?

    Hello

    Game 6' - 8 "wrote:
    Your understanding is quite correct. But unfortunately it doesn't Frank.

    SQL> SELECT COUNT (*)
    2    FROM (SELECT sp.*
    3            FROM spml sp, spml_assignment spag
    4           WHERE sp.spml_id = spag.spml_id
    5             AND spag.class_of_svc_id = 8
    6             AND spag.service_type_id IN (1706, 1194, 1817)
    7             AND spag.carrier_id = 4445
    8             AND NVL (spag.haulage_type_id, -1) = NVL (NULL, -1)
    9             AND spag.effdate = TO_DATE ('01/01/2000', 'mm/dd/yyyy')
    10             AND spag.unit_id = 5
    11             AND sales_org_id = 1
    12          UNION ALL
    13          SELECT sp.*
    14            FROM spml sp, spml_assignment spag
    15           WHERE sp.spml_id = spag.spml_id
    16             AND spag.class_of_svc_id = 1
    17             AND spag.service_type_id IN (1217, 1613, 1215, 1250)
    18             AND spag.carrier_id = 4445
    19             AND NVL (spag.haulage_type_id, -1) = NVL (NULL, -1)
    20             AND spag.effdate = TO_DATE ('01/01/2000', 'mm/dd/yyyy')
    21             AND spag.unit_id = 5
    22             AND sales_org_id = 1);
    
    COUNT(*)
    ----------
    88
    
    SQL> SELECT COUNT (*)
    2    FROM spml sp, spml_assignment spag
    3   WHERE sp.spml_id = spag.spml_id
    4     AND spag.carrier_id = 4445
    5     AND NVL (spag.haulage_type_id, -1) = NVL (NULL, -1)
    6     AND spag.effdate = TO_DATE ('01/01/2000', 'mm/dd/yyyy')
    7     AND spag.unit_id = 5
    8     AND sales_org_id = 1
    9     AND REGEXP_LIKE ('8:1706,1194,1817~1:1217,1613,1215,1250',
    10                      '(^|~)' || spag.class_of_svc_id || ':'
    11                     )
    12     AND REGEXP_LIKE ('8:1706,1194,1817~1:1217,1613,1215,1250',
    13                      '(:|,)' || spag.service_type_id || '(,|$)'
    14                     );
    
    COUNT(*)
    ----------
    140
    
    SQL> 
    

    Published by: release 6' - 8 "August 11, 2009 20:04

    Serving what you ordered!

    Originally, you said that you are looking for something that produces the same result as

    where   c1 in (8, 1)
    and      c2 in (1706, 1194, 1817, 1217, 1613, 1215, 1250)
    

    in other words, the c1s could be coupled with any of the c2s.
    Now, it seems that what you want is

    where     (     c1 = 8
         and     c2 IN (1706, 1194, 1817)
         )
    or     (     c1 = 1
         and     c2 IN (1217, 1613, 1215, 1250)
         )
    

    in other words, c1 = 8 and c2 = 1250 is not good; is not c1 = 1 and c2 = 1706.

    In this case, try

    WHERE     REGEXP_LIKE ( s
                  , '(^|~)' || c1
                         || ':([0-9]+,)*'
                         || c2
                         || '(,|~|$)'
                  )
    
  • Need help on transfer of files from one server to another server.

    Hi all

    I need help on transfer of files from one server to another server (Unix box to another Unix machine) using jdeveloper and BPEL process.

    I'm new to these technologies, can you please help me on this. If you encounter documents please share it with me.

    We use BPEL and Jdeveloper 10.1.3.3.0 version

    Thanks in advance!

    Concerning
    Vincent

    Published by: user10263255 on 15 Sep, 2008 12:25

    Vincent,

    One of the options I can think of is creating mount points on the boxes of unix and then using the File adapter.

  • When you rename a file change the last timestamp consulted?

    I was in a heated debate with one of my instructors today associated with a test on the access timestamp question when you rename a file. Through my research and testing to rename a file via the command prompt, it does not appear that the process of renaming a file will change the date of that last file access. Access and modify times will change to the directory that contains the file, but not the file itself.  So my understanding is that it is not, however, my instructor insists that it is, can someone shed some light on this topic please?

    Reading material more - it's interesting.

    More information under:

    Windows NT keeps track of three stamps of time associated with files and directories. These three temporal are written in creation, last access, and last. When a file or directory is created, accessible or changed, Windows NT updates the appropriate time stamp.

    http://support.Microsoft.com/kb/148126/a

    NTFS uses the change log to track information on the added files, deleted and changed for each volume.

    http://TechNet.Microsoft.com/en-us/library/cc938919.aspx

    Working with file systems

    http://TechNet.Microsoft.com/en-us/library/bb457112.aspx

  • How do you rename a file on the cloud?

    How do you rename a file on the cloud?

    There are two ways to rename the file. If you use file synchronization, then you can rename it after finding in the creative Cloud Files folder. Or you can rename it using the active site CC to https://assets.adobe.com and on the Actions menu, choose Rename.

  • How to send 31MB. WMV file using Outlook Express 6 on Windows XP?

    How to send 31MB. WMV file using Outlook Express 6 on Windows XP?

    If it is possible please provide step by step procedure.

    All attachments add about 33% size thanks to the encoding. This makes your 31MB file around 41 ~ 42 MB. I doubt that your ISP/mail server allows something that big, and of course, I would not be the recipient of a message that size.

    Create a YouTube account and put it there. You can make public or private and provide the link to the recipient.

  • Chips with 3 delimiter characters using regular expressions

    Hello world

    I have a function that is able to mark the input in a collection string using regular expressions.

    In case the input string is a character such as the comma or semicolon delimiter,

    We can just get the result we want like the example below.

    SQL> select * from v$version;
    
    
    BANNER
    --------------------------------------------------------------------------------
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    PL/SQL Release 11.2.0.1.0 - Production
    CORE    11.2.0.1.0      Production
    TNS for 64-bit Windows: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production
    

    SQL> with tab1 as (
      2      select 'abc,dfg,h,,1234' as col1 from dual
      3  )
      4  select regexp_substr(col1, '([^,]*)(,|$)', 1, level, 'i', 1) as result
      5  from tab1
      6  connect by level <= regexp_count(col1, ',')+1;
    
    
    RESULT
    ---------------
    abc
    dfg
    h
    
    1234
    

    But in the case where the channel of entry has 2 types of delimiter and each delimiter consists of 3 characters as below

    I wonder if it is possible to get the result as below.

    The input string: 01| ^ | ABCD| ^ | 111| * | 02| ^ | efgh| ^ | 222

    Separators: | * | is divided into lines, | ^ | is divided into columns

    Expected result:

    col1 col2 col3

    Row1 - > 01 abcd 111

    row2-> efgh 02 222

    Simply put, take a next

    The input string: 01| ^ | ABCD |^| 111 |*| 02 |^| efgh |^| 222

    Separator: | * |

    Result:

    01. ^ | ABCD | ^ | 111

    02. ^ | efgh | ^ | 222

    How can I achieve this using regular expressions?

    Kind regards

    Euntaek

    You need to know the number of the column from the outset:

    with tab1 as)

    Select ' 01 | ^ | ABCD | ^ | 111. * | 02. ^ | efgh | ^ | 222' as double col1

    )

    Select rownum,

    regexp_substr (regexp_substr (col1 '(.*?) ((\|\*\|)| $) ', 1, level, null, 1),'(.*?) ((\|\^\|)| $) ', 1, 1, null, 1) col1,.

    regexp_substr (regexp_substr (col1 '(.*?) ((\|\*\|)| $) ', 1, level, null, 1),'(.*?) ((\|\^\|)| $) ', 1, 2, null, 1) col2.

    regexp_substr (regexp_substr (col1 '(.*?) ((\|\*\|)| $) ', 1, level, null, 1),'(.*?) ((\|\^\|)| $) ', 1, 3, null, 1) col3

    of tab1

    connect by level<= regexp_count(col1,'\|\*\|')="" +="">

    /

    ROWNUM COL1 COL2 COL3

    ---------- ----- ----- -----

    1 01 abcd 111

    2 efgh 02 222

    SQL >

    SY.

  • How to extract the value of a tag XML using regular Expressions

    We get a response XML from a WEB SERVICE.

    I convert it to VARCHAR2.

    Now, I want to get the real answer that is inside the tag of the response.

    I tried this:

    DECLARE

    V_1 VARCHAR2 (30000): = ' < soap: Body > < ns:ProcessArgusFeedsResponse xmlns:ns = "urn: PegaRULES:SOAP:ArgusToPegaFeeds:Services" > ' |

    '< response > good < / answer >< / ns:ProcessArgusFeedsResponse > < / soap: Body > ';

    v_response VARCHAR2 (100);

    BEGIN

    DBMS_OUTPUT. PUT_LINE (V_1);

    v_response: = REGEXP_SUBSTR (v_1, ' / < >(.+?) < \/Response > answer /');

    dbms_output.put_line (v_response);

    END;

    It does not work.

    Any help would be greatly appreicated.

    Hello

    user12240205 wrote:

    We get a response XML from a WEB SERVICE.

    I convert it to VARCHAR2.

    Why?  XML has its own native ways of analysis; Why not use them?

    If you use regular expressions, then REGEXP_REPLACE, as shown above, is a good option in Oracle 10, but starting in Oracle 11.1, you can use REGEXP_SUBSTR like this:

    REGEXP_SUBSTR (v_1

    , '(.+?)'

    1

    1

    NULL

    1

    )

    The 6th argument is like a backreference; "He tells REGEXP_SUBSTR did not return to the entire organization, but only the part inside the 1st left '(' et correspondant à sa droite).

    The '?' to make it non-greedy is necessary only if v_1 can contain more than one response.

    Now, I want to get the real answer that is inside the tag of the response.

    I tried this:

    DECLARE

    V_1 VARCHAR2 (30000): = "" |

    'Good';

    v_response VARCHAR2 (100);

    BEGIN

    DBMS_OUTPUT. PUT_LINE (V_1);

    v_response: = REGEXP_SUBSTR (v_1, ' /(. +?)) <\ esponse="">/');

    dbms_output.put_line (v_response);

    END;

    It does not work.

    That's because it's looking for a slash ("/") before the '' tag and another after the ' tag.

    The backslash ("\") is not necessary here, but it is not nothing wrong.

  • Find the words (wild cards) using regular expressions

    I'm testing to see if the words are present for revision 1 of a drawing of the cartridge.

    The script search the digit 1 followed by a date, a title, and 4 sets of initials.

    The number 1 is static, (date, title and original are the cards that they are different for each design).

    I use regular expressions to match the words.

    The regular expression highlighted in blue is the number 1 and the date.

    Him remains highlighted in orange does not match the title and initials.

    If anyone can help with the regular expression that is most appreciated.

    Once I got that work will add the form fields for the initials, noting only the console at this point for the tests.

    numWords = this.getPageNumWords (0);

    number of words on the page

    loop through the words on the page

    for (var j = 0; j < numWords-1; j ++)

    {/ / get the pair of words to test}

    ckWords = this.getPageNthWord (0, j) + ' ' + this.getPageNthWord (0, j + 1); test words

    Check if 1 26.05.16 THE STRENGTHENING REVISED MM SB AE GM word string is present

    If (ckWords.match(/ ^ 1\s [0-9] {1,2}.)) [0-9] {1,2}. [0-9] {2} \s\w+(\s+\w+){1,7}/))

    {

    Console.println (ckWords);

    }

    }

    You can use something like this:

    ckWords = this.getPageNthWord (0, j) + ' ' + this.getPageNthWord (j, 0, + 1) + ' ' + this.getPageNthWord (0, + 2 j) + ' ' + this.getPageNthWord (0, j + 3) + ' ' + this.getPageNthWord (0, j + 4) + ' ' + this.getPageNthWord (0, j + 5) + ' ' + this.getPageNthWord (0, j + 6);

    If (! ckWords.match (/ ^ 1\s\d {1,2} \.\d {1,2} \.\d {2} \s\w+ (?:-s + \w +) {1.8} \s([A-Z]{2})\s([A-Z]{2})-s ([A - Z] {2}) \s([A-Z]{2})$ /)) ckWords + ckWords + "" + this.getPageNthWord (0, j + 7);

    If (! ckWords.match (/ ^ 1\s\d {1,2} \.\d {1,2} \.\d {2} \s\w+ (?:-s + \w +) {1.8} \s([A-Z]{2})\s([A-Z]{2})-s ([A - Z] {2}) \s([A-Z]{2})$ /)) ckWords + ckWords + "" + this.getPageNthWord (0, j + 8);

    If (ckWords.match (/ ^ 1\s\d {1,2} \.\d {1,2} {2} \s\w+ \.\d (?:-s + \w +) 1.8 ([A - Z] {2}) \s([A-Z]{2})\s([A-Z]{2})\s {} \s([A-Z]{2})$ /))

    {

    ...

  • A special character validation using regular expressions in ADF

    Hi guys,.

    I want to put the validation of a special as character (,.') ((en) &, -) using regular expressions.

    I asked the posting as [a-zA-Z0-9'(.),--/ &] but it does not work properly.

    Special characters should be like:

    Comma,

    Hyfan-

    Dot.

    Open and close braces (and).

    Ampercent &

    Apastrophy '

    Space ""

    Please help if anyone has idea.

    And I also tried to put under expression as...

    [a-zA-Z] + (\\s* [0-9] * [a-zA-Z] *-* & * \\(*\\) *, *'*. *) * [a-zA-Z0-9] + but we need the validation if we put special characters between the charater as "ab," chain "& (bc).

    his does not work if I put a special character at the beginning and the end of the string in the ADF

    Thanks Timo...

    its working fine...

  • Using Regular Expressions in the Code of edge

    Hello.

    I am quite new to the Edge Code but find it quite interesting to use.

    The find/replace feature is pretty but I got a little confused on how to use regular expression matching.

    I tried to clean up the coordinates of a file Adobe Edge animate full of 120.17px (heavy and less accurate)

    So basically you're looking \d+\.\d+px

    First of all, she says "use /re/ for regex" even though I know the Code is made for developers who * courses * know that it took me a little time to understand I should just put my regex between slashes.

    /\d+\.\d+PX/

    then the time comes to replace them. ALT-cmd-F and it says "replace".

    Puzzled again.

    Will I type my full sentence there? Maybe a «...» "written up somewhere around would avoid this question because, there, of course, a second field to come.

    And there, I got stuck.

    I can not find how to get the replacement of the model.

    tried to \1 $1 \1/ $1 / nothing seems to work... any hint of welcome.

    Franck,

    You are right that it does not work. I open a topic. Here is the link if you want to follow: https://github.com/adobe/brackets/issues/1861

    FYI, I know exactly how you want to replace the search results, but here are a few tips:

    You must set the text that you want to retrieve by using parentheses. Thus, for example, if you want the integer part of the number of the result, then your regexp would be: / (\d+)\.\d+px/

    Then you must specify the first result using $1, so (when it's fixed), you can use something like: $1px

    Thank you

    Randy

  • validate cfinput using regular expressions

    Hello

    can someone help me valditing a field of cfinput using regular expressions?

    First digit must be a number or a 'R '.

    Figure 2-15 can be anything without special characters. Figure 2-15 can also be empty.

    I try this, but it does not work (sorry I'm a beginner using regex).

    < cfinput type = "text" name = "field1" required = "yes" validate = 'regular_expression' pattern = "[0 - 9Rr] [0 - 9a - zA - Z]" * "maxlength ="15">"

    Thank you for advice!

    Claudia

    ^ [0 - 9Rr]([0-9a-zA-Z]{1,14})? $

  • String format using regular expressions

    Input string output format...
    
    SELECT q'<select ab_c "ABC", efg "EFG" from dual>' str FROM DUAL
    
    Output:
    
    STR                                  
    -------------------------------------
    select ab_c "ABC", efg "EFG" from dual
    
    
    Required output format using regular expression...
    
    
    STR                                  
    -------------------------------------
    select 'ab_c' "ABC", 'efg' "EFG" from dual

    Regular expressions have many limitations as tools of analysis, and you specify the rules you want. This expression puts quotation marks around a non-empty string before a quoted string:

    SELECT regexp_replace(q'