Need help with regular Expression (RegEx)

Try to wrap your head around a regular Expression for the following format example: 0022-C-4452 OR 0022-C-4452-C


* The 4 digits are always numbers

* The last 5 digits are alpha numeric

* Last (if used) digit is always 'C' (in reference to the second structure)

Hold the dashes for "auto fill" if possible? This would be in the Custom Format? Sequence of keys? Or Validation? I appreciate any help!

I still think that you did not correctly describe your problem.

1 figures of 4 characters.

Optional separator.

Then 6 alphanumeric characters and ' - '.

OR

1 figures of 4 characters.

Optional separator.

Then 6 alphanumeric characters and ' - '.

Optional separator.

Character 'C '.

Note that the "-" is not a number and not an alphabetic character. It is a white space character.

Try:

function {MyRe (cString)
var cFormatted = "";
var RE_MyCode0 = /^(\d{4})[-.]) {0,1} ([A-Za-a0 - 9-] {6}) $/;
var RE_MyCode1 = /^(\d{4})[-.]) {0,1} ([A-Za-a0 - 9-] {6}) [-.] {0,1} ([C]) $/;
If (RE_MyCode0.test (CString) == true) {}
cFormatted = RegExp. $1 + '-' + RegExp. $2;
}
If (RE_MyCode1.test (CString) == true) {}
cFormatted = RegExp. $1 + '-' + RegExp. $2 + '-' + RegExp. $3;
}
Return cFormatted;
} / / end of MyRe function;

some tests;
var MyString = "0022-C-4452; good channel;
Console.println ("Input:" + MyString);
Console.println ("result:" + MyRe (MyString));

var MyString = "0022-C-4452-C; string of Goo;
Console.println ("Input:" + MyString);
Console.println ("result:" + MyRe (MyString));

var MyString = "A022-C-4452" / / bad string;
Console.println ("Input:" + MyString);
Console.println ("result:" + MyRe (MyString));

var MyString = '0022-4452-CZ' / / bad string;
Console.println ("Input:" + MyString);
Console.println ("result:" + MyRe (MyString));

Tags: Acrobat

Similar Questions

  • Need help with regular expressions

    Hi all

    I need your help, because I have no ideas more...

    I have the following problem: in the column of the database table, I have the string with the names of files already uploaded to the database. For example: + File1_V01.txt +, + File1_v02.txt +, + File1_01_v01.txt +, etc. The string _vxx * + or _Vxx * + (non-case sensitive) represents the version of the file.

    Now the problem: I'll upload the file with the name + File1_v02.txt + (already exists in the table).
    If the file name already exists in the table the pl/sql function should get the name of the file with the following version number. In my case it takes + File1_v03.txt +.

    Is it possible to do this using SELECT with regular expressions?

    Best regards and thanks!
    with t as (
      select 'File_V05.txt' fn from dual union all
      select 'File_V04.txt' fn from dual union all
      select 'File2_v03.doc' fn from dual union all
      select 'File2_v115.doc' fn from dual union all
      select 'File2_v15.doc' fn from dual union all
      select 'File1_v03.doc' fn from dual union all
      select 'File1_v115.doc' fn from dual union all
      select 'File1_v999.doc' fn from dual union all
      select 'File2.doc' fn from dual union all
      select 'File2_v05.doc' fn from dual union all
      select 'File1_v01.txt' fn from dual union all
      select 'File1_v02.txt' fn from dual union all
      select 'File1_v1.txt' fn from dual union all
      select 'File1_v1.doc' fn from dual union all
      select 'File1_v2.txt' fn from dual union all
      select 'File2_v01.doc' fn from dual union all
      select 'File2_v02.doc' fn from dual union all
      select 'File1_ABC_v01_DEF.docx' fn from dual union all
      select 'File1_ABC_V02_ABC.docx' fn from dual union all
      select 'File1_ABC_v01_12_04_17.docx' fn from dual union all
      select 'ABC_V1_QWERT.pdf' fn from dual
    )
    
    select fn,
    case when fn!=fn_new then
     last_value(fn_new)
     over(partition by regexp_replace(upper(fn),'V[[:digit:]]+','') --(.*?V0*)([1-9]+)(\..*?)$
     order by nv
     rows between unbounded preceding and unbounded following
     )
    else fn
    end fn_new
    from (
        select
        case when v-1 <= 0 then fn
        else
               regexp_replace (fn,
                        '(_v|_V)(\d*)',
                        case
                        when length(substr(fn,v+1,p-v-1)+1) > (p-v-1)
                        then '\1'||to_char(substr(fn,v+1,p-v-1)+1)
                        else '\1'||lpad(substr(fn,v+1,p-v-1)+1,p- v-1,0)
                        end
               )
        end fn_new
        ,fn
        ,case when v-1 <= 0 then -1
         else
            substr(fn,v+1,p- v-1)+1
         end nv
        from (
            select fn, regexp_instr(upper(fn),'_V[[:digit:]]+',1,1,1) p, instr(upper(fn),'_V')+1 v from t
        )
    )
    order by fn
    
    FN     FN_NEW
    ABC_V1_QWERT.pdf     ABC_V2_QWERT.pdf
    File_V04.txt     File_V06.txt
    File_V05.txt     File_V06.txt
    File1_ABC_v01_DEF.docx     File1_ABC_v02_DEF.docx
    File1_ABC_v01_12_04_17.docx     File1_ABC_v02_12_04_17.docx
    File1_ABC_V02_ABC.docx     File1_ABC_V03_ABC.docx
    File1_v01.txt     File1_v3.txt
    File1_v02.txt     File1_v3.txt
    File1_v03.doc     File1_v1000.doc
    File1_v1.doc     File1_v1000.doc
    File1_v1.txt     File1_v3.txt
    File1_v115.doc     File1_v1000.doc
    File1_v2.txt     File1_v3.txt
    File1_v999.doc     File1_v1000.doc
    File2.doc     File2.doc
    File2_v01.doc     File2_v116.doc
    File2_v02.doc     File2_v116.doc
    File2_v03.doc     File2_v116.doc
    File2_v05.doc     File2_v116.doc
    File2_v115.doc     File2_v116.doc
    File2_v15.doc     File2_v116.doc
    
  • Need help with regular expression

    I have a string like: separation by a comma as G, H, L

    the table has values like this

    Col1 Col2
    ROW1 G
    ROW2 F
    ROW3 L

    What is trying to achieve is to find out if G or H or L in the string of separated by commas are in col2. is it possible by using regular expressions or not we do split and the loops?

    Thanks in advance.

    Hello

    ora1001 wrote:
    I have a string like: separation by a comma as G, H, L

    the table has values like this

    Col1 Col2
    ROW1 G
    ROW2 F
    ROW3 L

    What is trying to achieve is to find out if G or H or L in the string of separated by commas are in col2. is it possible by using regular expressions or not we do split and the loops?

    Thanks in advance.

    You don't even need regular expressions

    INSTR ( ',' || col1 || ','
          , ',' || col2 || ','
          )
    

    will be greater than 0 if (and only if) co12 is one of the elements of col1.

    If you're curious, a way of using regular expressions is

    REGEXP_LIKE ( col1
             , '(^|,)' || col_2 || '($|,)'
             )
    

    but it will be less effective than Instr.

    Published by: Frank Kulash, November 5, 2010 11:38

  • HELP WITH REGULAR EXPRESSIONS

    Hello
    I'm just experimenting with regular expressions

    My information in table are as shown below
    TABLE NAME: -  EMP_TEST
    
    STRUCTURE WITH DATA
    
      X_NAME
    ---------------------
    12456com
    ab1245com
    AXM4554.com
    Now, I pulled the following query to find the rows that have 1
    select *
    from emp_test
    where regexp_like (x_name,'[1]')
    
    RESULT AS EXPECTED : -
    
    
      X_NAME
    ---------------------
    12456com
    ab1245com
    Now, I want to do a query that will give me tose lines that do not have 1

    Initially I have run the following query
    select *
    from emp_test
    where regexp_like (x_name,'[^1]')
    
    RESULT NOT AS EXPECTED : -
    
      X_NAME
    ---------------------
    12456com
    ab1245com
    AXM4554.com
    After a bit of searching on Google I found an application that works as expectd
    select *
    from emp_test
    where regexp_like (x_name,'^[^1]*$')
    
    RESULT AS EXPECTED : -
    
      X_NAME
    ---------------------
    AXM4554.com
    Where my basic question is that all seeking a 1 in a row we do not put the beginning ^ end $ and so on and the
    Works of query.
    So why do [^ 1] does not work as shown, while excluding an amd why is ^ [^ 1] * $ necessary while excluding a

    Hello

    Elessar wrote:
    So why do [^ 1] does not work as described

    Because regexp_like(str,'[^1]') means: search str who have at least one character that is not 1.
    When regexp_like(str,'^[^1]*$') means: search str done characters that are not 1 start (^) at the end ($)

  • have dell dimension 4700 xp need help with outlook express I have error message and can not send email

    I need help to figure out why my outlook express does not work when I try to send a link, or email. I have a dell dimension 4700 xp restored. The error message cannot find the server with an error code number. I am a newbee so one who responds to it will have to break it down for me. So far, I had lots of help from proceeding to audio and graphics, and I am totally grateful for the help I get.

    Thank you, Gina Davis

    I have

    He has already worked with Outlook Express? Using OE? Hotmail is a Webmail service.

    How to add your Hotmail e-mail account to Microsoft Outlook Express
    http://windowslivehelp.com/solution.aspx?SolutionID=99d4b13d-13dB-40D8-9cdf-172002d4194c

    If you don't want to use OE to access Hotmail and want to just use IE to access Hotmail, then just copy the link and paste it into a new message from Hotmail.

  • Need help with GREP expressions

    I know - KNOW - there is a way to do it, but keep my GREP expressions.

    I want to add an em dash before any sentence that is in a paragraph style. So I obviously want the em dash to be in the 'start of the paragraph' location. Lack of keep all my GREP searches. Can anyone help?

    Adobe of the 'start of the subsection' implementation is just a little off the coast of standard GREP (which, in itself, is less a set of hard and fast rules but rather as "guidelines"). Yes - you can Search for beginning of paragraph using plain ^, but you cannot use it with a replace operation.

    The trick is to give something to look for in InDesign. Search

    ^.
    

    (it's just - a wildcard just after the start of a paragraph). You don't want to lose the character it finds, so replace it with

    ~_$0
    

    where the first 2 codes is your dash and the last 2 is 'the text together. This is your original found generic character!

    Don't forget to put your paragraph style in the box of formatting to find.

    Of workaround works around the failure of implementation, because indeed, you want to add something to an existing text. Unfortunately, another pretty standard GREP to search for empty paragraphs-^ $-does not work, because then you have no room for a wildcard... (and Yes, you pouvez use a hard return instead of code \r is first or last, but then it will not work at the beginning or at the end of the story). It's one of those things that I wish to see corrected with CS5.

    [Edit] HA! Peter beat me to it, but he has made a typo. In addition, my story is longer.

  • Please help with regular expression

    Hello

    With the help of my previous answers of the detachment, Re: procedure to extract several substring of a string , I've updated the query. But I don't get the answer you want in all cases. Could you please help me? My query is based on the previous announcement. Any other way to do this?
    I'd really appreciate it.
    select 
           ltrim ( regexp_substr(txt, '\[(\w+)', 1, level), '[')      as id, /* id is number */
           ltrim ( regexp_substr(ltrim ( regexp_substr(txt, ':[^]]+', 1, level), ':'), '\w+-*\d*', 1, 1), ':')  as qid, /* Qid could be char/number/space any combination except ':' */
           ltrim ( regexp_substr(ltrim ( regexp_substr(txt, ':[^]]+', 1, level), ':'), '\w+', 1, 2), ':')      as num,
          to_date( ltrim ( regexp_substr(ltrim ( regexp_substr(txt, ':[^]]+', 1, level), ':'), '[^:]+', 1, 3), ':'),'MM/DD/YY')   as effdate
    from  (
                            select  '[10946:M100:N:][10947:Q1222:N:][38198:PPP-2:N:][13935:PPP-6:N:][38244:QQQ-4:Y:01/01/10]'     as txt
                            from     dual
             )
            connect by level <= length(regexp_replace(txt, '[^[]'));
    I should get:
    ID             QID          NUM         EFFDATE
    10946     M100     N     
    10947     Q1222     N     
    38198     PPP-2     N     
    13935     PPP-6     N     
    38244     QQQ-4     Y     01-JAN-10
    But, be
    ID             QID          NUM          EFFDATE
    10946     M100     N     
    10947     Q1222     N     
    38198     PPP-2     2     
    13935     PPP-6     6     
    38244     QQQ-4     4     01-JAN-10
    Thank you

    Hello

    If the column number is wrong, isn't it?
    Describe what should be the num column. For example "num is the 3rd part of :-delimited list placed in square brackets.

    If this is what you want, and then change the definition of number of

    ...                     ltrim ( regexp_substr(ltrim ( regexp_substr(txt, ':[^]]+', 1, level), ':'), '\w+', 1, 2), ':')      as num,
    

    TO

    ...                      REGEXP_SUBSTR  ( REGEXP_SUBSTR ( txt
                                          , '[^]]+'
                                                , 1
                                       , LEVEL
                                       )
                             , '[^:]+'
                             , 1
                             , 3
                             )       AS num,
    
  • Need help with the installation of an adapter of Palit GeForce 9500GT Super chart - 512 MB in a M2N68 (narrated

    Need help with the installation of an adapter of graphics Super Palit GeForce 9500GT - 512 MB - DDR2 SDRAM in a M2N68 motherboard (narra6). Should I disable the onboard graphics in the bios? When the card is installed, no VGA work outs and the PC does not start. Checked and recontroler implementation of the card in the PCI slot. PC is a desktop HP G5200uk PC. Windows 7 operating system.

    Hello

    The link below is a guige to install a video card in your Pc.  In particular, it seems that you will have to perhaps specify the location of the new card in the bios and save this change before you install the new card - see step 4 in the guide on the link below.  If your new card fits into the PCI Express x 16 slot, you will need to define PCI Express in the bios and save the changes.

    http://support.HP.com/us-en/document/c01700855

    Kind regards

    DP - K

  • Need help with query between 2 dates

    Hello

    I did not SEE in a long time and need help with a simple query.

    I have a table of DB access with 3 fields, name, date and number

    What I want is to create a query to retrieve all the names between 2 dates

    When I ask the date field, the results are showing in this formats 2013-07-12 00:00:00

    Here's my query

    < cfquery datasource = 'mydb' name = 'test' >

    SELECT name from myTable

    where edate between ' 2011-01-01 00:00:00 ' AND ' 2013-01-01 00:00:00 '

    < / cfquery >

    < cfoutput query = 'test' >

    #name #.

    < / cfoutput >

    What I get is this error

    ODBC = 22005 (assignment error) error code

    [Microsoft] [ODBC Microsoft Access driver] Type mismatch of data in the expression of the criteria.

    Don't know what I'm doing wrong here.

    Please let me know.

    Thank you

    SELECT ename

    FROM MyTable

    WHERE edate BETWEEN

    AND

    #ename #.

  • Need help with this gallery of xml!

    I have build a gallery but its very simple... There are pictures of the xml file.

    I have attached all the zip files.

    I just want two things if anyone can help.

    first of all when I press the next button, he's going to the next image, but without effect. It just displays the following image... I want to incorporate the effect of dragging when the image is changed to another.

    and secondly, I want to use the AutoPlay feature.

    Once swf starts images came one by one with a vertical drop of a few seconds.

    Thanks in advance... I really need help with this..!

    For the look of sliding effect using the actionscript class Tween.  Allows you to create motion tweens using the code.  The example below will be tween property _x of the instance named anObject from 0 to 300 in 3 seconds...

    import classes before using

    Import mx.transitions.Tween;
    Import mx.transitions.easing.Regular;

    TW var = new Tween (anObject, "_x", Regular.easeIn, 0, 300, 3, true);

    To implement an enforcement function auto you need to import all the images first, in the order, then you will need to use form any controlled timer, such as setInterval (with clearInterval not to need) in order to have things turn on automatically by some part-time

  • I'm suddenly needing help with my browser Firefox (6.0.2)

    Hello
    I'm suddenly needing help with my browser Firefox (6.0.2)

    (OS: I use Windows XP).

    When I open the browser, I don't see is a totally white screen of white, with all the toolbars at the top.

    I know that my physical connections are very good: I have tested the modem, turned the pc market etc and I can also receive/send emails.

    This problem started today, September 8, 2011 and has never happened before.

    Is it a coincidence that Firefox itself to day before I disconnected yesterday evening? Could this be something to do with this particular new update?

    I also noticed that just before I "opened" Firefox, I now get a small box indicating:

    [JAVASCRIPT APPLICATION]
    Handl exc in Ev: TypeError: this oRoot.enable is not a function

    This never appeared before - I hope that it offers a clue has what is wrong.

    The browser not be stuck in Mode safe, said by the way.

    Of course, I can't find solutions to the problem on the internet, I don't physically see all Web sites!
    (A friend sends this request in my name from their pc)

    Any light you can throw on this problem of confusion would be much appreciated. I'd rather not have to uninstall and reinstall Firefox if possible.

    If the only option is to uninstall Firefox and reinstall from your site, I'm also in trouble (I can not see the internet or download).
    In this case, would you be able to send the .exe file as an attachment to my e-mail address? In the affirmative, please let me know and I'll give you more details.

    Thanks in advance.

    One possible cause is security software (firewall) that blocks or limits Firefox or plugin-container process without informing you, possibly after the detection of changes (update) for the Firefox program.

    Delete all rules for Firefox in the list of permissions in the firewall and leave your firewall again ask permission to get full unlimited access to the internet for Firefox and the plugin-container and the update process.

    See:

    Start Firefox in Firefox to solve the issues in Safe Mode to check if one of the extensions of the origin of the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > appearance/themes).

  • Need help with installation on Photosmart C7280 all-in-one

    I had my printer is installed and has been using the printer for 3 wireless laptops in my house.  Now, I can't even find my backup drive, so I have need help with downloading the software to use my printer and also get to use wireless.   I don't know what happened, but the fax for this printer is listed, but not the printer itself.   Help, please!

    Click here to download the software for your printer:

    http://h10025.www1.HP.com/ewfrf/wc/softwareCategory?product=3204785 & LC = on & CC = US & DLC = in & lang = to & CC = US

    has chosen the appropriate operating system that corresponds to your computer and download the full software features.

  • HP laptop: need help with internet and search for things

    whenever I'm on chrome internet explore google ect and go to tab it is says unknown error or no internet connection or anything and just takes me chrome ect. I need help with this im involved in a byod class and my computer won't let me on what whatever usually it just starts out black and white and the seeds I my search request

    Yes it's a Windows 10 and it arrived already installed I'll take the other info now

  • need help with my window is in thai and I do not understand to all.how to convert to English?

    need help with my window is in thai and I don't quite understand.
    How to convert to English? I tried for days but still it cannot be changed.
    because I can't read thai... Please help me step by step...

    my pc is touchsmart 9100 windows 7 Professional.

    Not a single word is in English if I go to the "region and language" to change.

    Everthing is in thai in the system.

    Hello

    Where have you bought the PC?

    What is the operating system installed?

    Best regards

    ERICO

  • I need help with an installation failure to interpret and troubleshoot a Setup log.

    Background: A few years ago, many editors of cinema used Final Cut Pro 6 (also contained in Final Cut Studio 2) for their editing projects.  Shared Apple Final Cut X uses a different format that is not compatible with FCP6.  Sometimes, these editors are called to work on a few historical projects that have been published in FCP6 and need this version to run now.

    Starting with OS X Lion, FCP6 would install not in Lion and thereafter.

    According research by Jeremy Johnston as noted on his blog, he discovered that Apple has inserted a file in the folder CoreServices in the Library folder of the system folder that causes versions the version Final Cut Pro X (and other older Apple programs in the same situation) do not settle.  He suggested changes to this file that would seek to prevent interfering with the installation of FCP6 in Lion, many users of final cut PRO 6 were successful in their efforts to install in Lion and work with it.

    Later in a discussion update on installing FCP6 in Mavericks, HawaiianHippie determined that the simplest way to perform the installation of FCP6 was simply copy this file and remove it from the system folder, install FCP6 and then restore the copied file:

    https://discussions.Apple.com/message/26309669#26309669

    I used this method with success to install FCS2 in Yosemite:

    [click on images to enlarge]

    However, in my attempts to install FCS2 in El Capitan, it fails in the last 5% to install the first DVD:

    First of all, I need advice on how to display an extremely large Setup log in this thread (on MacRumors, it is a method to insert a 'code' in a small box that can be the object of a scrollbar if necessary to read all along).  I am unable to find such a method to post here.

    Then once approved, I need help to determine which component is causing the installation to fail and perhaps this element can be omitted from the installation:

    If this element is not required, then maybe FCP6 can be installed successfully without it.  And if that omitted element is necessary, perhaps a manual method to install it can be determined by pacifists.

    It is my goal to help those who need to install and use FCP6 on their new Macs running El Capitan.

    Here is the post on MacRumors with pre-installed Setup log:

    http://forums.MacRumors.com/threads/i-need-help-with-an-installation-failure-to-interpret-and-troubleshoot-an-Installer-log.1954786/#post-22541389

Maybe you are looking for