Regex find number at end of string

Hi guys,.

I try to learn regex, but it's hard and I'm stuck to a simple task:

Let's say I have this string:

"C1".

I would like to find what is the number to the end of the line. I can do with this regular expression ' [0-9] + $".

Now if this chain was formed with a small error, say a character 'space' after the number:

"C1".

My regex would not '1 '.

What should I change in my regex to find the last number in the string, even if it has an error?

P.S. The string can contain several numbers, such as "C5_IND1". My regex must return '1 '.

Use the look early.  I sounds like you want the last number which is not followed by another number:

(\d+) (?!. * \d)

Tags: NI Software

Similar Questions

  • Replace the page to find number by matching the string

    Hi all

    Write the script (InDesign CS5) update the page number of the collection of the Keyterms end of this chapter. These keyterms inside this chapter applied with a character named "KT" style Here, I have collected text style applied all the "KT" with its page number appropriate by using the following code. The keyterms collection have the paragraph style "KTSET" and the page number character style "KTSET_PG". Between these two, there may be some em space or space en dash or space of Word. I just want to change these page instead of "000" number corresponding to its text (keyterms) appropriate. For example, autpatu 000 mmoloreetue must be autpatu mmoloreetue 2. I match these two strings and replace the single page number.

    KeyTerm.png

    var myDoc = app.activeDocument;
    app.findTextPreferences = null;
    app.findTextPreferences.appliedCharacterStyle = myDoc.characterStyles.item("KT");
    var myResults = myDoc.findText();
    var myFoundText = new Array;
    for (var i = 0; i < myResults.length; i++)
    {
        var r = getPage(myResults[i].characters[0]);
        myFoundText.push ([myResults[i].contents, r.name]);
    }
    alert(myFoundText)
    
    function getPage (element)
    {
        while (!(element instanceof Page || element instanceof Application))
        if (element instanceof Character)
        element = element.parentTextFrames[0].parentPage;
        else element = element.parent;
        if (element instanceof Page)
        return element;
        return null;
    }
    

    Any ideas or some suggession would be useful for me.

    Thanks in advance.

    Try this:

    app.findGrepPreferences.findWhat = "\\b (" + myText.toLowerCase () + "\\s) 000".
    app.changeGrepPreferences.changeTo = "$1" + myPage;

  • Conversion number to a hex string

    Hello

    I want to send a command string hex to a device via the serial port. The chain includes a fixed part (address, function, register) and editable part (setpoint). The fixed part is a string constant hexa (0106 0022) the editable part is a number (1000) converted to string hex (03E8). Finally, the two are coding pour get the final string. The problem is that instead get: 0106 0022 03E8, I get: 0106 0022 3033 4538.

    After concatenates two strings, it seems that the second part is turned into ASCI.

    I can't find the solution!

    Thanks for your help.

    Sorry, I saved the vi in a different version.

  • How can I find number of objects in a layer?

    I have a document with hundreds of layers. I want to delete the specific purpose of layers. I iterate through all the layers, but I couldn't iterate over objects within a single layer to find that specific object.

    I there a way I can go through all objects in the layer?

    or

    How can I find number of objects in a layer?

    I'm going through the API documents but could not find.

    Here is the code I wrote,

    var artLayer = undefined;
            if(app.documents.length == 0)
            {
                app.documents.add();
            }
            var myDocument = app.activeDocument;
            var layerCount = myDocument.layers.length;
            
            
            for (var index = layerCount - 1; index >= 0; index-- ) 
            {
                var targetLayer = myDocument.layers[index];
                var layerName = new String( targetLayer.name );
                if(layerName == "Colorways")
                {
                    artLayer = myDocument.layers[index];
                   
                    //Can I iterate through objects in a layer??
    //                for(var newIndex = 0; newIndex < artLayer.items.length;newIndex++)
    //              {
    //                    Need something like this
    //                }
    
    
                    break;
                }
            }
    

    instead of points, you should use "pageItems.

    for (newIndex var = 0; newIndex)< artlayer.items.length;newindex++)="" there="" is="" no="" "items"="">

    for (newIndex var = 0; newIndex)<>

    or as in your second post, instead of the activeDocument, target your layer

    index

    index

  • Hi, how can I find number emei of stolen iPad that I erased remotely

    Hi, how can I find number EMEI of my stolen iPad that I erased remotely

    Conny, check down here. It's the only way.

    Find the serial number or IMEI on your iPhone, iPad or iPod touch - Apple Support

  • How to search for a location number anywhere in the string

    I am looking for a string to a number (integer or float) without knowing its index in the string and to extract it - whether in digital format or a string.  for example "52,63 number appears in this string." I want to extract/identify "52,63.

    The functions I've met seem to expect the index to be known or number to be at index 0.  How can I achieve this?

    Best regards.

    Kenoss


  • Find and replace the delimited string value by the

    Hi all

    I have a requirement where I need to find and replace the delimited string values.

    For example, the string is "GL ~ 1001 ~ 157747 ~FEB-13~ CREDIT ~ A ~ N ~ US ~ NULL ~". The 4th column gives the month and year. I need to replace it with the name of the previous month. For example: "GL ~ 1001 ~ 157747 ~JAN-13~ CREDIT ~ A ~ N ~ US ~ NULL ~". I need to do the same thing for the past 12 months.

    I thought initially divide the values and store it in a variable and then after him substituting the value required, join the return.

    I just wanted to know if there is a better way to do it?

    Like this:

    with a model like

    (select "GL ~ 1001 ~ 157747 ~ FEB-13 ~ CREDIT ~ A ~ N ~ $ ~ NULL ~' double UNION ALL data")

    Select ' GL ~ 1001 ~ 157747 ~ JAN-13 ~ CREDIT ~ A ~ N ~ US ~ NULL ~' double data)

    Select

    REPLACE (DATA, TO_CHAR (to_date (substr (data, 16.6), "MON-RRRR"), 'MON - RR'), TO_CHAR (to_date (substr (data, 16.6), "MON-RRRR")-1, 'MON - RR'))

    modeling;

    GL ~ 1001 ~ 157747 ~ JAN-13 ~ CREDITS ~ HAS ~ N ~ US ~ NOTHING ~

    GL ~ 1001 ~ 157747 ~ DEC-12 ~ CREDITS ~ HAS ~ N ~ US ~ NOTHING ~

    Ishan

  • Y at - it no limitation for the number of end users

    Hi guys,.

    Is there a limit to the number the end users?

    Which is only based on the specifications of the server and editing of Oracle. Is this true?

    Kind regards
    Fateh

    Fateh says:
    Thanks, Justin.

    I use only 11g xe. I have no idea about licensing of users.

    Oracle Database Express Edition licenses information® 11 g Release 2 (11.2), see especially the section "license fees". Oracle 11g Express Edition has no restrictions based on the number of users.

    See also Oracle Technology Network Developer for Oracle Database Express Edition license terms.

    However, as I have received from you:
    Suppose I have a license for 25 users:
    Then I will use three of them for:
    APEX_PUBLIC_USER
    FLOWS_FILES
    APEX_040100
    For my application, I can create unlimited number of users.
    Is this true?

    No 'Users' in the conditions of licence does not refer to database schemas (alias database users ). You can create as many databases of patterns you want.

    'Users' in the conditions of licence refer to real human users. For editions other than XE Oracle database, you can have named user licenses or processor of licenses. Username licenses require that you know exactly who is using the software, for example a user named for 5 users license allows Alice, Bob, Carlos, Dave and Fateh to use the database and applications based on it. Of course, for most practical purposes with internet/intranet applications developed using APEX you don't know who is using them. (For some applications internet you want as many people as possible to use). In these cases based processor licenses based on the specifications of the hardware used to run the application is the norm. As the material capacity should increase the load on the system, it is supposed to scale with the number of users (anonymous). Processor licenses are so much more expensive than the username.

  • Convert number like 1, 2 strings 01 and 02?

    Can convert us integers [] as 1.2 in 01 and 02 channels, I need these numbers as a text to a TextField.

    That converts the phone number provided to a string of length specified adding the 0 prefix as required

    private function convertNumberToPaddedString(num:Number, length:int):String
    {
        var numString:String = num.toString();
    
        if (numString != null && length > 0)
        {
            while (numString.length < length)
            {
                numString = "0" + numString;
            }
        }
    
        return numString;
    }
    

    for example the trace (convertNumberToPaddedString (3, 2)); Converts the number 3 in a string of length 2

  • Find multiple instances of a string

    You can use ReFind to find multiple instances of a string? I know I could use getOccuranceCount, but I would use rather just ReFind.

    Thank you.

    Thanks Adam,.

    I think I found my solution. It's just not very elegant.

    getOccuranceCount is a function that is out there that tells you how many times a string occurs. It is useful, but I need to channel it returned.

  • The research of pattern at end of string

    Hello

    Maybe it's something that is really simple, but I searched for two days and can't seem to find what I'm looking for.  What I need is to query an ADDRESS field for records that have an apartment at the end number that begins with a letter followed by two or three numbers (A100 or A09).  I use WHERE SUBSTR(ADDRESS,-4) to return just the last four characters of the ADDRESS of the string in the field, but I can't ' seem to determine how get so it does show me that the values that follow the model that I'm looking for.

    I tried without success to the following:

    WHERE SUBSTR(ADDRESS,-4) LIKE '_' - but it gives me values where there are four characters any

    It has really puzzled me that any suggestions are appreciated.

    Hello

    Here's one way:

    WHERE REGEXP_LIKE (address

    , ' [[: alpha:]] [[: digit:]] {2,3} $'

    )

    [[: alpha:]] means any alphabetic character, uppercase or lowercase

    [[: digit:]] means a digit (0-9)

    {2,3} means that the above should occur between 2 and 3 times

    $ signifies the end of the string

  • How to find the mode of a string array

    Hey guys,.

    Then I came across this little problem that I thought I could solve easily enough, but it turned quite messy.

    I have this array of strings, and I want to find the most frequent entry in this array. Let's say I have the following table.

    Apple

    Apple

    Kiwi

    Orange

    Apple

    the mode would give me apple. I thought to convert the strings into a number and then find fashion as usual.

    But if the chain is too long, it seems a superelevation of unique number used to represent.

    Any ideas on a clean way to do this?

    This can also work

    Nick

  • Number of a specific string format

    Colleagues Labview users,

    I'm quite familiar with Labview, but for some reason, I can't understand how to do the following:

    I need to format a number (a number) to a string of the form "mmmmee", where m is a number and 'ee' the exponential. For example:

    0.0128 becomes 1280-5

    1654086 becomes 165403

    0.0000006 becomes 0600-9

    etc.

    I would appreciate any advice.

    Thank you!

    Here is a quick sketch. I'm sure that some of the regex wizards will come back with something more simple.

    He needs some work still. For example, if the value is zero or negative, or if the Exhibitor resulting is more than 2 digits, you must also further handling. I am dealing with negative exponents that are more than 1 digit (i.e. 2 digits, including the sign).

  • Find everyday odd or a string in the Notes field.

    In our environment, we are looking for a way to make sure some VMS are on the correct storage node.  I've got code working now, but like all things, I would like to make it that much better.

    Most of the time, we want our odd number VMs to stay on our 'A-Side' storage and our even number VMs to stay on storage of 'b-side '.  A virtual machine is even or odd by the number given in the Notes field.

    For example Notes for would look like this for a SINGLE virtual machine.  "Prod - payments - TC #02 ticket.

    It is the line that I am looking to clean.

    $VMs = get-data center < Center >. Get-DatastoreCluster | where {$_.} Name.Contains('-A-Side')} | Get - VM | where {$_.} Notes.Contains ('2') - or $_. Notes.Contains('#4') - or $_. Notes.Contains('#6') - or $_. Notes.Contains('#8') - or $_. Notes.Contains('#10') - or $_. Notes.Contains('#12') - or $_. Notes.Contains('#14') - or $_. Notes.Contains('#16') - or $_. Notes.Contains('#18') - or $_. Notes.Contains('#20') - or $_. Notes.Contains('#22') - or $_. Notes.Contains('#24') - or $_. Notes.Contains('#26') - or $_. Notes.Contains('#04') - or $_. Notes.Contains('#06') - or $_. Notes.Contains ('#08')} | Select Name, Notes

    Yes, this is WAAAAY too long, but it do the job.  I also have a space after '#2' to make sure that it isn't catching #20 virtual machines etc..

    Now, I know you can use %2 - eq 0 to find the odd or even days, but I don't know how to look at the field notes of powershell, remove the #XX and then check whether it is even or odd.

    Ideas?

    Try with a RegEx expression and the modulo function.

    Something like that

    $VMs = get-datacenter  |     Get-DatastoreCluster |     where {$_.Name.Contains('-A-Side')} |     Get-VM |     where {([regex]::Match($_.Notes,"#(\d*)").Groups[1].Value % 2) -eq 0) |    Select Name, Notes
    
  • Generic, RegEx Find &amp; Replace Help Needed

    I'm in a time CAP and need some advice. I want to understand RegEx, but right now need a quick fix.

    I have a HUGE body of code that has a type of paragraph repeating everywhere, different contents in each particular case. I need to treat these paragraphs stand out by adding a rule above and below the surrounding text. The above rule is obvious, because of the class, this is the unique identifier for the paragraph, so I have to use for the weaker rule as well. I insert a string after the closing < /p > tag of each paragraph. I need a generic configuration that will escape the contents variable of all these paragraphs, but leave them intact afterwards.

    Let's say that this represents the structure of paragraph:

    < class p = "para_PN" > PN: [content Variable] < /p >

    That's what I have to do to move on hundreds of cases:

    < class p = "para_PN" > PN: [content Variable] < /p > < p > [element added to all] < /p >

    Is the closest, I came:

    To find:

    < class p = "para_PN" > ([^ <] *) < /p >

    Replace with:

    < class p = "para_PN" >$ 1 < /p > < p > [element added to all] < /p >

    But it stores the data for the first wildcard and stops later. Apparently I need a $ 2, $ 3, etc. for each instance and it is not convenient... It is already too.

    Any ideas or solutions would be appreciated.

    Thank you!

    Cayce

    I'm not sure that I fully understand what you're trying to do. If it is to make these paragraphs are distinguished by adding a rule upper and lower, the simplest way to do so is with CSS:

    {.para_PN}

    border-top: 3px solid #000;

    border-bottom: 3px solid #000;

    }

    However, if you want to add a text in a paragraph, it is the regular expression that you need:

    (

    [\w\W]+?

    )

    In replace with field:

    $1

    It is a new text.

    When you click on replace all, Dreamweaver goes through paragraphs correspondents one at a time. $1 replaces the original paragraph, and then the new text is added.

Maybe you are looking for

  • Cashback after 30 days is almost impossible

    Time to claim my cashback after 30 days and guess what, find how to do is almost impossible.In addition, the wording of big title of 'claim after 30 days, in the 60' is actually in the table of contents, you will need to also register after 30 days,

  • VRML loading screen

    Hello Do a small project where I take a folder full of files, VRML and loading in an image control. The problem is that it can take a little time to do it according to the number of files is. I was wondering if it is possible to build a loading scree

  • HP Pavilion laptop cursor will not move with the pad of the finger.

    From the beginning to the top finger button not work or move the slider. I tried out the battery but no change. I can type my password on the keyboard but don't know how to use the keyboard rather than the fingerpad of

  • BlackBerry smartphones adjusting my ringer volume

    My ringtone is so strong!  Ho I control my ringer volume?

  • Bateria para hp mini 110-1140la

    Hola, queria saber as types of baterias are para ese modelo equipos, yo poseo are of 3 cells y Necesito UN saber if there baterias of mas of 6 cells. Gracias.