Using the regex to match the file name with date time

Hello all,
currently I had problem to match the following file name with the date time. Of course I can use this regex like ""(\\\\w+|.+).(zip)" to match it. However in the current application i need to parse the file name and get the current date time to check if it is matched. Does anyone have good idea?
{code}
testfile10-08-09-2008-08-21-04-24-0443.zip
testfile11-08-09-2008-08-22-04-24-0441.zip
{code}
thanks in advanced!

lauehuang wrote:
Hello all,
currently I had problem to match the following file name with the date time. Of course I can use this regex like ""(\\\\w+|.+).(zip)" to match it.That regex doesn't make a lot of sense:
- with "\\\\w" you probably meant "\\w";
- "\\w+|.+" doesn't make sense: you can simply do ".+" in that case;
- ".(zip)" will also match the string "%zip" or "Ezip".
However in the current application i need to parse the file name and get the current date time to check if it is matched. I don't know what you mean by that.

Similar Messages

  • Generating file name with date

    Hello,
    I try to create via ABAP a file name with date in it. Normaly my script must run but the script won't run. Please help. Thanks.
    data = sy-datum.  " = data set to sys date
    data+6(2) = '01'. " = first day of month
    data = data - 1.  " = last day of last month
    file name creation
    p_filename+0(21) = '/sapio/flatfiles/xxx/'. " = first part of file name
    p_filename21(6) = data0(6). " = second part of file name
    p_filename+27(15) = '_XXXX_XXXXX.csv'. " = last part of file name
    p_subrc = 0.
    Regards, Thomas

    Hi again!
    Now I try it with your hints but now I got a save error.
    program conversion_routine.
    * Type pools used by conversion program
    type-pools: rsarc, rsarr, rssm.
    tables: rsldpsel.
    * Global code used by conversion rules
    *$*$ begin of global - insert your declaration only below this line  *-*
    * TABLES: ...
    * DATA:   ...
    data: data like sy-datum.
    *$*$ end of global - insert your declaration only before this line   *-*
    form compute_flat_file_filename
         using p_infopackage type rslogdpid
      changing p_filename    like rsldpsel-filename
               p_subrc       like sy-subrc.
    *       Insert source code to current selection field
    *$*$ begin of routine - insert your code only below this line        *-*
    * Datum wird gebaut
    data = sy-datum.  " = data set to actual date
    data+6(2) = '01'. " = first day of month
    data = data - 1.  " = last day of month before
    v_date = data+0(6).
    * Dateiname wird gebaut
    p_filename = '/sapio/flatfiles/XXX/'v_date'_XXXX_XXXX.csv'.
    p_subrc = 0.
    *$*$ end of routine - insert your code only before this line         *-*
    endform.

  • File name with Dateand time stamp.

    Hi All,
    I want to generate a file with a date and time stamp.
    For that in File Receiver adaptor i am using option "Add Time Stamp" in File Construction mode. however it is generationg file name as: FileName_20082104_121211_645.txt . In this I don't know what these last three characters "_645" are? And In the File name i only want a file name with datetime stamp . I don't require underscore in between. for eg: FileName_20082104121211.txt (FileName_dateTime.txt)
    Can anybody suggest me the way to achive this?
    Thanks,
    Atul

    @FileName_20082104_121211_645
    The date time stamp in XI's file adapter will be in that format. This is to avoid over writing of files created simultaneously at the same time. So the last 3 digits is a form of an unique id to distinguish between the same.
    In case you want the format as FileName_20082104_121211, use the dynamic configuration and create the file name inside the mapping itself and pass it across.
    To get an idea about the same, ref:
    /people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14 - an usage of the same.
    http://help.sap.com/saphelp_nw04/helpdata/en/43/03612cdecc6e76e10000000a422035/frameset.htm

  • Have file name with date working but appending the time to file name can't get a result

    DECLARE @dt AS VARCHAR(26)
    SELECT @dt = REPLACE(CONVERT(VARCHAR(26),getDate(),110),'-','-'
    Have this appended to a filename like: log_01-15-2015.  Don't know what to add to SQL code to get the get the time and append time in hours, min, sec. like:  log_01-15-2015_10:01:33  
    DECLARE @dt AS VARCHAR(50)
    SELECT @dt = REPLACE(CONVERT(VARCHAR,CURRENT_TIMESTAMP,110),'-','-') +'_'+ CONVERT(VARCHAR,CURRENT_TIMESTAMP,108)
    EXEC master.dbo.sp_configure 'show advanced options',1
    RECONFIGURE WITH OVERRIDE
    EXEC master.dbo.sp_configure 'xp_cmdshell',1
    RECONFIGURE WITH OVERRIDE
    SET @bcpCommand = 'bcp "SELECT * FROM ##Temp ORDER BY barcode" queryout "C:\TEMP\Log\ContainerHistory_Log_' + @dt +'" -c -T'
    EXEC master..xp_cmdshell @bcpCommand
    I am trying to append to the file created with the date a time stamp but when appending the time part for the filename results aren't creating the file.  If it's just doing the date part then it is working. Any idea what is wrong? 

    Since you added ":" to the file name, the file name is not valid. You can change ":" to "-".
    DECLARE @dt AS VARCHAR(50)
    SELECT @dt = CONVERT(VARCHAR,CURRENT_TIMESTAMP,110) +'_'+ REPLACE(CONVERT(VARCHAR,CURRENT_TIMESTAMP,108), ':', '-')
    SELECT @dt
    A Fan of SSIS, SSRS and SSAS

  • How to Use FULL TEXT Indexing Search on file names with brackets

    I would like to use a FULL Text Seach query to find Files on a windows file system
    The Problem is when the case comes up where there is a parentheses"()" in the file name. This example was created from a file copy being pasted in the same folder location as the original a few times.
    Here is my code:
    DECLARE
    @SearchWord VARCHAR(50)
    SET @SearchWord = '"KAP1556PP_P01(2).jpg"'
    SELECT [FileName], [FilePath] FROM [dbo].[tblLegalPlan] WHERE CONTAINS(*, @SearchWord)
    When I use Double quotes for the @Searchword I recieve no results.
    SET
    @SearchWord = '"KAP1556PP_P01(2).jpg"'
    When I remove the Double  Quotes for the @Searchword I recieve an error message:
    SET
    @SearchWord = 'KAP1556PP_P01(2).jpg'
    Msg 7630, Level 15, State 2, Line 8
    Syntax error near '(' in the full-text search condition 'KAP1556PP_P01(2).jpg'.
    When I search for files containing TEXT up to the bracket i Get undesrired results obviously:
    SET
    @SearchWord = '"KAP1556PP_P01*"'
    Results
    FileName FilePath
    KAP1556PP_P01(1).jpg BC\EPP\KAP
    KAP1556PP_P01(2).jpg BC\EPP\KAP
    I would like results where I can search for the file name and only one file is found matching the search word.
    Thanks

    Is this a SQL Server Reporting question?  You maybe better off posting this in a more relevant forum.

  • Receiver File Name with date

    Hi @,
    I have a requirement where I wanted to genereate the recevier file name as TestYYYYMMDD.txt format.
    Note that in Receiver target structure date is not coming and output file also we dont require date data.
    I tried to put the Date root node and date field in target structure and in Receiver FCC i have not put the Date root node name but still date data is generated in output file.
    Since its a Comma separated file hence I can not use CUT option which is applicable for Fixed length file.
    I used the time stamp option but it is giving HH.MM.SS details which i dont want.
    Is there any other options available.
    chirag

    You can add a node 'TRAIL' with 'FILENAME' sub-node; Your target format is like this:
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:MT_FILE_STRING_OUT xmlns:ns0="HTTP://WWW.XXX.COM">
       <Recordset>
          <Row>3</Row>
       </Recordset>
       <Trail>
          <Filename>DFS-XXX-20090804173307</Filename>
       </Trail>
    </ns0:MT_FILE_STRING_OUT>
    When mapping, the UDF can be:
    (imports: java.text.SimpleDateFormat;)
    SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
      String ds = sdf.format(new Date(System.currentTimeMillis()));
      String filename = "DFS-ADSFCL-" + ds;
    return filename;
    In file adapter, you can use the adapter attributes to get the file name and the conversion to cut the trail node in the file...
    Done!

  • Implement check for File Names with data into TRG table

    hi,
    I am trying to load the Multiple files names & Autonumber to oracle table T1 which is further loaded the auto-number with data to target table TRG. My problem is when the same name file comes again due to size then load it again. & also don't insert Target (TRG) table rows with same data while insert the only those records/rows which are not in Target Table(TRG) .. Is this standard approach. becoz in this way I thing loading Performance speed will b down??
    Any other or best recommended approach???/
    Thanks
    Regards,
    AMSIII
    Edited by: AMSI on Dec 11, 2012 9:54 PM

    Hey Jason,
    Create a validation of type exists. in expression 1 put:
    SELECT 1
    FROM DUAL
    WHERE UPPER(:P9_FILE) LIKE '%TEST.HTML';
    {code}
    change P9_FILE to your file browse item name and change '%TEST.HTML' to '%YOUR_FILE_NAME'
    Hope this helps,
    Tyson                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • File name with latest time stamp for inbound interface

    Hi experts,
    I have a requirement to develop an inbound interface in which I need to fetch the all files from the physical directory, and then retrieve the one with the latest timestamp. I found out the FM 'SUBST_GET_FILE_LIST', but this FM does not gives me the timestamp.
    Is there any other FM/table through which this can be achieved?
    Thanks,
    Mohit.

    Can you please try with these functionmodules???
    1)ITS_DIRECTORY_LIST_FILES
    2)CL_GUI_FRONTEND_SERVICES=>DIRECTORY_LIST_FILES

  • I am using OSX 10.9.5 and Outlook Web App for emails. When I download an attachment it replaces the space in the file name with   - how can I change this?

    I am using OSX 10.9.5 and Outlook Web App for emails. When I download an attachment it replaces the space in the file name with %20  - how can I change this?

    Click on the below link :
    https://get.adobe.com/flashplayer/otherversions/
    Step 1: select Mac OS  X 10.6-`0.`0
    Step 2 : Safari and FIrefox
    Then click on " Download Now"  button.

  • How to rename the SharePoint Document Library existing file name using Web service

    Hi,
    How to rename the SharePoint Document Library existing file name using SharePoint Web service.
    Is it possible. How could i do it?
    Thanks & Regards
    Poomani Sankaran

    Hi,
    Lists.UpdateListItems Method
    would be helpful for your requirement.
    Here is a blog with code demo for your reference:
    http://blogs.msdn.com/b/knowledgecast/archive/2009/05/20/moss-using-the-list-web-service-to-rename-a-file.aspx
    Best regards,
    Patrick
    Patrick Liang
    TechNet Community Support

  • Reading from a file. How to ask the user for file name at run time????

    I have the code to read from a file but my problem is how to prompt the user for the file name at run time.
    import java.io.File;
    import java.io.FileNotFoundException;
    import java.util.InputMismatchException;
    import java.util.Scanner;
    public class FileRead {
        public static void main(String args[]) {
            Scanner scan = null;
            File file = new File("Results.txt");
            String number;
            try {
                scan = new Scanner(file);
                while (scan.hasNext()){
                number = scan.next();
                System.out.println(number);}
            catch (FileNotFoundException ex1){
                System.out.println("No such file");
            catch (IllegalStateException ex2){
                System.out.println("Did you close the read by mistake");
            catch (InputMismatchException ex){
                System.out.println("File structure incorrect");
            finally{
                scan.close();}
    }Any hints would be greatly appreciated. Thank you in advance

    I have read through some of the tutorials that you have directed me too and they are very useful, thank you. however there are still a few things that i am not clear about. I am using net beans 5.0 I have placed a text file named Results.txt into the project at the root so the program can view it.
    When I use the code that you provided me with, does it matter where the file is, or will it look through everywhere on the hard drive to find a match?
    This code compiles but at run time it comes up with this error
    run-single:
    java.lang.NoClassDefFoundError: NamedFile
    Exception in thread "main"
    Java Result: 1
    BUILD SUCCESSFUL (total time: 3 seconds)
    import java.util.Scanner;
    import java.io.*;
    class NamedFileInput
      public static void main (String[] args) throws IOException
        int num, square;   
        // this Scanner is used to read what the user enters
        Scanner user = new Scanner( System.in );
        String  fileName;
        System.out.print("File Name: ");
        fileName = user.nextLine().trim();
        File file = new File( fileName );     // create a File object
        // this Scanner is used to read from the file
        Scanner scan = new Scanner( file );     
        while( scan.hasNextInt() )   // is there more data to process?
          num = scan.nextInt();
          square = num * num ;     
          System.out.println("The square of " + num + " is " + square);
    }his is the code that i used. It is the same as the code you posted for me (on chapter 23 I/O using Scanner and PrintStream) Sorry im just really stuck on this!!

  • If i download any file which is prepare on microsoft office 2007 . The file have been download without extension of the prog. Means if files name is "1,docx" when i download from firefox it download in that form "1". after download i have to rename and gi

    If i download any file which is prepare on microsoft office 2007 . The file have been download without extension of the prog. Means if files name is "1,docx" when i download from firefox it download in that form "1". after download i have to rename and give the extension name is plz tell me the way that office files are compatible with it.
    == This happened ==
    Every time Firefox opened
    == when i download the office files

    In Firefox Options / Privacy be sure "Remember download history" is checked. To see all of the options on that panel, "Firefox will" must be set to "Use custom settings for history".
    To find your OS information, on your Windows desktop, right-click the My Computer icon, choose Properties, under System on that small window is info about your OS.
    '''If this reply solves your problem, please click "Solved It" next to this reply when <u>signed-in</u> to the forum.'''

  • Need help changing the setting to preview entire file names

    Using Leopard, I would like to to be able to read the entire name of a file.
    For example, my files might say (File 2.....609). What the file is named is File 2 Graphs 6209. How can I set up Leopard to allow me to read the entire file, so I don't have to guess the file?

    Ah! I tend to avoid using column view for folders containing items with long names, because it increases the amount of horizontal scrolling needed to see everything, & because I'm usually interested in seeing & sorting items by the non-name columns available in list view.
    FWIW, I tried the column view drag handle double click tip on one of the folders containing some of my extra long named items & it does expand to show the entire name, but I don't care for the result: the Finder window expands horizontally so much that it won't all fit within even a 24" widescreen display! So not only do I have to scroll the window's content horizontally to see everything, I have to move the window partially offscreen to do so. That is too much of a chore to make this a very good alternative for long path names.
    It occurs to me that there might be a more elegant, subtle, & "it just works" Apple-like solution possible: instead of just abbreviating the displayed item name by replacing enough of the middle characters of the name with an ellipsis to make it fit, it would be cool if this were adaptive & tried first to abbreviate the non-unique parts of the name, relative to all the items in the column. So if say 3 files in a view contained the same 12 character sequence, that sequence would appear with the same abbreviation in each file, more frequently preserving the display of the unique parts of each file name.
    Does this make sense?

  • File name and Date Display as an obj not the data

    All,
         The issue that I am having is that when I view a Visio file hosted on SharePoint. The file was created in Visio 2007 and when it is opened by Visio 2007 and Visio Viewer in SharePoint. The file name field object and date
    modified object show the information. The issue is when the file is opened by a device that has Visio 2010 the information does not show. Is there something that I can do for these users to have it show correctly.

    Hi,
    Which way did you open the Visio 2007 file in SharePoint?Opened it in the browser or downloaded it to open? I had test in my environment. Insert a text box>Add a data/time field, it worked fine both in Visio 2007, 2010.
    Thus, let‘s do some test to narrow down the issue’s reason. 
    1.Download the Visio 2007 file and open it with Visio 2010.
    If it worked fine, the issue seems more related to Visio object and sharePoint connection.
    If it does not display the information in Visio 2010 by a device client, the issue was more related to Visio 2010 client.  
    2.Create a new drawing included file name and Date
    field in Visio 2010.
    If the new drawing displays correct, the issue is more related the original, please try to repair the file or re-create the file name and Date filed.  
    If the new drawing still displays incorrect, please try to start Visio 2010 in safemode, some third-party add-ins my be casued the issue.
    If the issue still exists, try to repair Visio 2010.
    Regards,
    George Zhao
    TechNet Community Support

  • When I open up an e-mail attachment a box pops up PRINT TO FILE below that line OUTPUT FILE NAME with an empty line for the file name vs. simply going to my default printer?

    when I open up an e-mail attachment a box pops up PRINT TO FILE below that line OUTPUT FILE NAME with an empty line for the file name vs. simply going to my default printer?

    Make sure that '''''Print to File''''' isn't selected in the native print dialog box ''(see screenshot below)'' middle-right, and make sure your Printer is selected at the top of that dialog box.
    ''I'm a little confused why an email attachment would need to go directly to the printer, but that's what you asked about.''

Maybe you are looking for

  • Java - php

    Hi Can I ask what's wrong with the following code? I got 2 area in a html page, I want to press a button, then it will pass some information to area 2 which is the php script to manipulate. public void actionPerformed(ActionEvent e) {      AppletCont

  • GROUP BY grouping sets

    Hello everybody, I have this query SELECT ALL             M_PAGAMENTO||' '||D_TIPO MPAGA,             grouping(F.KIND_F),             DECODE (grouping(F.KIND_F), 0 , 'Totali IVA',F.KIND_F)  a1,              case              when grouping(F.KIND_F) =

  • 2LIS_11_VAHDR want to add order status

    I am trying to modify 2LIS_11_VAHDR to include MCVBUK -> GBSTA, which is the overall status of an order.  I go into LBWE and click on Maintain.  Other fields from MCVBUK are available to move over from the right side of screen to the left.  Why is MC

  • Same photo in multiple projects?

    Hi there. New Aperture user here so hope this isn't a stupid question. I was wondering if it's possible to have the same photo in multiple Projects? My understanding is that all photos are stored in my Aperture Library but the photos in the Projects

  • Solutions for Printing houses

    I do investigations for nice solutions for Printing houses. SAP have IS for Media, but it doesn't fit customer needs. He  is looking especially for actual print job calculations, scheduling, planing, disaster recovery. They are printing newspapers, b