Choose the Second word of the string

How to get the second word in a string. Each word is separated from the space. If there is only a single word, to return the first word

For example:

"abc of anus ijk" I need to go back to

If the string is

'abc', I need to return to abc

Thanks in advance

Hello

Try this:

Select NVL (regexp_substr (your_string, "[^ [: space:]] +' 1, 2"), your_string) double

Tags: Database

Similar Questions

  • How to choose the value of a string are numeric together and words of letters (for example, TEST)

    Hi all

    How to choose the value of a string are letters (for example, TEST) and all numeric...

    for example
    TEST 123456
    TEST 34567
    123456 ABCD
    1234 TEST
    TESTING 12345
    TEST 1@234$
    YOUR T 123456

    I want the results of the query as below.
    TEST 123456
    TEST 34567

    And I tried to use regexp_like in this case but without success. See the code below.
    SELECT * FROM TABLE WHERE regexp_like (Description, ' [TEST] % & [[: digit:]] + $');

    How can I do this, please answer.

    Thank you

    WF

    If you want to return only the rows that contain the string 'TEST', followed by zero or more space characters, followed by one or more digits?

    How about this:

    SELECT *.

    FROM my_table

    WHERE REGEXP_LIKE(description,'^TEST\s*\d+$')

  • Oracle regular expressions - splits the string into words for

    Hello

    Nice day!

    My requirement is to split the string into words.

    So I need to identify the new line character and the semicolon (;), comma and space like terminator for string entry.

    Please note that I am currently embedded blank and the comma as separator, as shown below.

    Select regexp_substr('test)
    TO
    string in words, "([^, [: blanc:]] +) (', 1, 1) double;"

    How to integrate the semicolons and line break characters in regular expression Oracle?

    Please notify.

    Thanks and greetings

    Sree

    This has nothing to do with REGEXP. Is SQL * more parser does not not a semicolon at the end of the line:

    SQL > select ' testto, mm\;
    ERROR:
    ORA-01756: city not properly finished chain

    SQL >

    Just break the chain:

    SQL > select regexp_substr ('testto, mm\;' |) '
    2 string into words
    3 \w+',1,level ',') of double
    4. connect by level<= regexp_count('testto,mm\;'="" ||="">
    5 string in words
    6      ','\w+')
    7.

    REGEXP_SUBSTR ('TESTTO, MM\;' |') STRINGIN
    --------------------------------------
    Testto
    mm
    string
    in
    Words

    SQL >

    Or modify SQL * more the character of endpoints:

    SQL > set sqlterm.
    SQL > select regexp_substr ('testto, mm\;)
    2 string into words
    3 \w+',1,level ',') of double
    4. connect by level<=>
    5 string in words
    6      ','\w+')
    7.

    REGEXP_SUBSTR ('TESTTO, MM\;) STRINGINTOWO
    --------------------------------------
    Testto
    mm
    string
    in
    Words

    SQL >

    SY.

  • I have two frames of texts linked on one page. But during an iteration by using everyitem() he chooses the second before the first?


    Salvation by the Expert


    I have two frames of texts linked on one page. But during a iteration using everyitem() he chooses the second before the first?

    var ObjDoc = app.activeDocument;
    var LstPara is ObjDoc.pages.everyItem ().textFrames.everyItem ().paragraphs.everyItem () .getElements ();.

    for (c1 var = 0; c1 < LstPara.length; ++ c1)
    {
    by var = [c1] LstPara;
    $.writeln (par.contents.toString ());
    }


    is there a specific reason for this? Please explain

    To solve your problem, try the following code:

    
    var ObjDoc = app.activeDocument;
    var LstTxtFrame = ObjDoc.pages.everyItem().textFrames.everyItem().getElements();
    
    for(var c1=LstTxtFrame.length-1;c1>=0;c1--)
    {
        var LstPara = LstTxtFrame[c1].paragraphs.everyItem().getElements();
        for(var c2=0;c2
    

    I have two frames of texts linked on one page. But during a iteration using everyitem() he chooses the second before the first?

    is there a specific reason for this? Please explain

    Text blocks InDesign will work in LIFO method (last in first out), that is, the last image of text created will be treated as a first picture of the loop, so try the above code.

    Vandy

  • Replace the last occurrence of a word in a string

    Hello

    I need to replace the last occurrence of a word in the string. Example of form:

    "I like fruits and vegetables as" need to replace the last occurrence of 'like' that is just before the vegetables and not 'as' before the fruit.

    Something like that!

    SELECT
        REGEXP_REPLACE('I like fruits and also like vegetables','like','hate',1,2) data_col
    FROM dual;
    
  • Words in the string?

    I have a string

    for example: ' Welcome to flash forums!

    I need a function that returns the number of words (sperated by spaces)

    The string is not user entered, so if I need to understand something between words to achieve this, it is possible...

    Thank you.

    Use the string split method

    var st:String = ' Welcome to flash forums! "

    Var words: Array = st.split("");

    trace (Words.Length);

  • regexp_substr - how to search for two different words and result based on returning a different part of the string

    Hello everyone

    I fight with this regexp_substr and I wonder if there is a way to deal with it. I have two string type in a column with the following structure:

    structure 1 always starts with "app.catalog.school.", as the following three examples

    app.catalog.school.DB.BT

    app.catalog.school.B.FTA

    app.catalog.school.ACA.CD

    structure 2 always begins with "app.catalog.admin.", as the following three examples

    app.catalog.admin.C.ABC

    app.catalog.admin.BT.AP

    app.catalog.admin.MI.RT

    If the value of the field begins with "app.catalog.school." it should return everything after the last period (.) as follows

    BT

    FREE TRADE AGREEMENT

    CD

    If the value of the field begins with "app.catalog.admin." it should return the string between the third and fourth period (.) as follows

    C

    BT

    MI

    I actually have a solution to this:

    decode)

    regexp_substr (myfield, ' [^.] +' 1, 3), 'school', regexp_substr (myfield, ' [^.] +' 1, 5), "admin", regexp_substr (myfield, ' [^.] +' 1, 4)

    )

    I am not happy with the solution above using decode(). I think I should be able to solve this problem purely with reg_exp but after hours to try again without success. You have better solution/suggestion?

    I use Oracle version 10.2. Thank you very much.

    Oops: Oracle version 10.2, here to use regexp_replace

    WITH testdata UNTIL
    (SELECT 'app.catalog.school.DB.BT' FROM DUAL str

    UNION ALL

    SELECT 'app.catalog.admin.C.ABC' FROM DUAL
    )

    Select
    Str
    , regexp_replace (str, ' ^. * (admin | school\.)) [ ^.] +)\. ([^.] +). (* $', "\2") res
    of testdata

    RES STR

    "app.catalog.school.DB.BT" 'BT '.

    'app.catalog.admin.C.ABC' 'C '.

    to 11.x, we can use regexp_substr because he has this subexpression setting more pure accident.

    WITH testdata UNTIL
    (SELECT 'app.catalog.school.DB.BT' FROM DUAL str

    UNION ALL

    SELECT 'app.catalog.admin.C.ABC' FROM DUAL
    )

    Select
    Str
    , regexp_substr (str, ' (admin | school\.)) [ ^.] +)\. ([^.] +)', 1, 1, null, res) 2.
    of testdata

    STR RES
    app.catalog.school.DB.BT BT
    app.catalog.admin.C.ABC C

    Post edited by: extended chris227

  • How to count the number of words in a string?

    It is only possible by counting the number of white spaces in the string?

    You can use the String.Split method to divide the string into an array using the character space as delimiter, and then check the length property of the resulting table.

  • Extraction of text from the strings in a single cell of a row of cells

    Hello

    Is there an easier way to search a text / word of a string in the row of cells, and where a match is found back a header text - see the example below.

    The left table contains the initial positions of conformity in groups of companies. I would like to complete the table on the right with compliance positions indicated in the table on the left, using the header text (red zone). Example 1 shows that "C company" is not in line with the left table and returns a "Non-compliant" in the relevant cell for company C. Example 2 A company, C and Z are in line with the left table and returns "comply" in the relevant cell in company A, C and Z respectively. It goes the same for the partial.

    The lines must also be aligned as shown in the left column will contain a single reference (not shown in the example).

    My current approach was to simply build a small matrix and use IF (COUNTIF ($E5, "* company A *" "'), 'In line'," "") - this works fine, but is a bit messy - obtained above table, it's really what I like o would reach.

    I also tried to use nested 'FI', 'find', 'Index' and 'Match' combinations, based on a few positions at the beginning, but not could not get the correct syntax.

    Would appreciate other solutions for the construction of the table to the right.

    Thank you in advance...

    Pasel

    This may work for you:

    A2 = if (COUNTA ('Table 1 - company compliance Positions': $A2) > 0, IF (LEN ('Table 1 - company compliance Positions': $A2) −LEN (SUBSTITUTE ('Table 1 - company compliance Positions': $A2, A$ 1, "")) > 0, 'table 1 - company compliance Positions': $A$ 1, ' '), "") & IF (COUNTA ('Table 1 - company compliance Positions': $B2) > 0, IF (LEN ('Table 1 - company compliance Positions': $B2) −LEN (SUBSTITUTE ("table 1 - company compliance Positions")) ((((: $B2, a$ 1, ' ')) > 0, "table 1 - company compliance Positions": $B$ 1, ' '), "") & IF (COUNTA ('Table 1 - company compliance Positions': $C2) > 0, IF (LEN ('Table 1 - company compliance Positions': $C2) −LEN (SUBSTITUTE ('Table 1 - company compliance Positions': $C2, A$ 1, "")) > 0, "table 1 - company compliance Positions": $C$ 1, ""), "")

    It's shorthand dethrone select cell A2, and then type (or copy and paste it here) the formula:

    = IF (COUNTA ('Table 1 - company compliance Positions': $A2) > 0, IF (LEN ('Table 1 - company compliance Positions': $A2) −LEN (SUBSTITUTE ('Table 1 - company compliance Positions': $A2, A$ 1, "")) > 0, 'table 1 - company compliance Positions': $A$ 1, ' '), "") & IF (COUNTA ('Table 1 - company compliance Positions': $B2) > 0, IF (LEN ('Table 1 - company compliance Positions': $B2) −LEN (SUBSTITUTE ("table 1 - company compliance Positions")) ((((: $B2, a$ 1, ' ')) > 0, "table 1 - company compliance Positions": $B$ 1, ' '), "") & IF (COUNTA ('Table 1 - company compliance Positions': $C2) > 0, IF (LEN ('Table 1 - company compliance Positions': $C2) −LEN (SUBSTITUTE ('Table 1 - company compliance Positions': $C2, A$ 1, "")) > 0, "table 1 - company compliance Positions": $C$ 1, ""), "")

    Select cell A2, copy

    Select cells A2 at the end of column F, dough

  • How to choose the alternative address for email?

    I have in my address book for recipients who have more than one e-mail address. I want to be able to choose the second address. For the moment, I can't work out how to do this automatically.

    Click "address book".
    Select the address book that contains the contacts
    Select the contact
    Info is displayed in the lower list below
    Double-click the alternative e-mail address.
    It is opened in a new write a message to this e-mail address.

  • HP pavilion 15-e034tx: how to choose the right RAM for laptop

    How to choose the right RAM for my laptop (Pavilion 15-e034tx). I know I should buy DDR3 ram.

    Are there other factors should I consider when buying one? I got 2 slots for ram, which od these combos are possible?

    1-4 + 4 GB
    2-4 GB + 8 GB
    3-8 GB + 8 GB

    Thank you

    From the Manual:

    Two customer accessible/upgradable memory module slots

    Support for dual channel DDR3L (1600 MHz)

    Support 8192 MB RAM system in the following configurations:

    8192 MB (8192 MB × 1, × 4096 MB 2)

    Manual download link

    See page 53 for instructions. Memory access is easy via the service Panel. This is the part number for the approved 4 HP concert module:

    4 GB (PC3L, 12800, 1600 MHz) 691740-001

    http://www.Amazon.com/HP-691740-001-4GB-1600MHz-PC3L-12800/DP/B00CI08FX4/ref=sr_1_2?ie=UTF8 & qid = 1451655870 & SR = 8-2 & Keywords = 691740-001

    A 8 GB module is listed in the manual, and it's a 3rd generation of processor i5 I suspect 2 x 8 = 16 concerts would work, but strictly following the manual your only option is to add a 4 GB for a total of 8. Most users really not more 8 GB and adding a second identical module will allow two-channel operation, so you should see a noticeable jump in the overall performance.

    If it's 'the Answer' please click on 'Accept as Solution' to help others find it.

  • Choose the network protocol for CRIO-9024 to PXI on Ethernet

    We are in the design phase, implementation of an embedded controller for CRIO-9024 to send data captured at an SMU-8105 on ethernet controller. The data will be arrays of double-precision 2D. These data should be sent to the pxi at the end of each test step. Each stage will have a different number of channels and sampling frequencies.

    For example, Test step 1 will have 5 channels of analog inputs that will be sampled to 100,000 KHz for 1 second. These data will come from the CRIO FPGA. Data will be get dealt with by the CRIO-9024 and analyzed post to pass or not not metric. Then, the CRIO controller will send the data 2D (data points 500 000 5 X 100 000) table and the results of all the measures (a table 1 d) for PXI.

    The connection with the PXI will use Ethernet.

    Do not forget that the PXI should also send the CRIO certain values to tell the CRIO when starting the test, and when the test sequence is completed.

    I thought that TCP/IP would work better because of communication 2-way necessary. But then I was watching streaming network or even using shared Variables.

    If anyone has any ideas or suggestions please please post them.

    Hello

    You can use either.  If you are more comfortable with really.  The STM method will be a little less overhead on my style XML tagging data, but it will be very short given the size of the data.  Probably go with STM has it right most of the work for you.

    Regarding the size data the you must normally transfer data as this is to flatten to a string.  If you convert a string of numbers readable human you will either lose accuracy, increase the size or both.  Because the string after that flattened will be the same size as the original array anyway for the quick calculation based on your previous post 500 000 double (8-byte) is 4 miB (3.8 MB)

    See you soon,.

  • In Labview 8.6 and MAX, I can change a scale for a voltage read the string in a task once the application has been built and installed.

    In Labview 8.6 and MAX, I can change a scale for a voltage read the string in a task once the application has been built and installed on a second PC. Where's the info of the scale which is held?

    Hello

    Once you have built your VI and compiled into an executable file and deployed on another machine, it essentially becomes a file read-only, which means that you will not be able to change the balance in this deployed application.

    Kind regards

    Marcus

  • Select the string table drop-down list box.

    Hi all

    I want to select the combo box list based on a string in the entry, I don't know how to do this. I have a drop-down list box and the value comes from a database, what I want to do is I want to change the value of the selected box based on the existing value in the database drop-down list. for example, A, B, C D I strings in the drop-down list box, and then in my database, I have a field with the string C, I want to change the C to A. I can't enter the value of C in a string format, but I don't know how to be the first position of the drop-down list box in so the order of channels combo box will be C, A, B, d., the value of C

    Thank you

    Then just write a new array of strings, with the elements of the new agenda, to the "[] strings" - property.

    Either you must code something that allows you to create an array of strings with the elements in the order that you want them to be. If there is a reorganization only, you could do something like:

    -Get the array of strings [] from the drop-down list using a property node box.

    -Find the position of the element you want to place first and use "delete from table", which returns the new array and the element removed.

    -Build a new table 1 d of the deleted item and table remaining. Move to the second combobox Strings [] property of a node property.

  • Length of the string, excluding the input character/string

    Long story short, I want to replicate the function of the length of the string , but do not include an input the number of characters in string. For example:

    The input string (search) is 'the

    My first string to test is "the big red dog."

    That would mean a 13 string length.

    My second string is "Jumps over the lazy Fox."

    That would mean a length of 21.

    ' Hello World! ' would return 12.

    'The Lion, the Witch and the wardrobe' would return 26.

    I hope that you can see what I want to achieve. How is this possible?

    -James

    (I'm driving Labview 8.5)

    Use the search and replace the string to replace your 'exclusive' with an empty string string.  Use the length of the string on the result string.  Make sure that everything is already set to TRUE.

Maybe you are looking for