REGEXP: String normalization

Hi all

Is it possible to normalize a string using a REGEXP to follow this rule:


1. If the string begins with BLOCO or LOTE channels, keep it in the beginning of the string.
2. keep the first channel number
3 - If the first number is followed (after a space) that a single character include the number
4 - If the first number is concatenated characters keep the whole word.



Examples of data with examples:

WITH t AS
(SELECT 'LOTE 1' input_string,
         'LOTE 1' output_string
    FROM dual
  UNION ALL
  SELECT 'BLABLA 1' input_string,
         '1' output_string
    FROM dual
  UNION ALL
  SELECT 'BLOCO 11 A 3' input_string,
         'BLOCO 11A' output_string
    FROM dual
  UNION ALL
  SELECT 'BLOCO 3A' input_string,
         'BLOCO 3A' output_string
    FROM dual
  UNION ALL
  SELECT '4 A' input_string,
         '4A' output_string
    FROM dual
  UNION ALL
  SELECT '5 AA' input_string,
         '5' output_string
    FROM dual
  UNION ALL
  SELECT 'LOTE 6 RC' input_string,
         'LOTE 6' output_string
    FROM dual
  UNION ALL
  SELECT 'LOTE 7-A' input_string,
         'LOTE 7-A' output_string
    FROM dual)
SELECT *
  FROM t;

Kind regards

Manel

Post edited by: Manuel Vidigal Typo in "BLOCO 11 A 3"output ".

Then

Select

input_string

output_string

regexp_substr)

regexp_replace (input_string, ' (\d) ([^ [: digit:]] (| $))', "\1\2", 1, 1)

,'(^ BLOCO. | ^Lote) [^ [: digit:]] * \d [^] * | \d[^] * "

) o

t

Some explanantion:

First in the regexp_replace replace us (I modified it) the first occurrence of a followed by a space and a number digt not) with numbers and his successor non-chiffres.

And then from there we take if the string begins with BLOCO or LOTE everything from the beginning selection until the first digit and after this figure in the next space or at the end if there is no following space.

If there is no key words at the beginning only since the first digit comes from the same way as above.

Tags: Database

Similar Questions

  • RegExp string transform help

    Hello

    My version of Oracle: 11G

    Here is a string I get in a flat file:

    2009-01 - 01 T 14: 02:02.789

    My requirement is to transform in 2009-01-01 14:02:02

    (1) T must be replaced by a space

    point 2) and the characters that follow must be replaced by null

    PS: I realized using multiple functions, but you are looking to do this using a function only, I guess regexp_replace might help me thereby or is it does nothing else.

    Concerning

    Rahul

    One more way!

    regexp_replace ('2009 - 01-01 T 14: 02:02.789 ',' t |) () \. [[ : digit :]] * $) «, » ')

  • Features of LabView string StartsWith as in c#?

    Hi all

    in c# (.NET) there is a good class: String

    There, it is possible for example to get information, if the string startswith one substring special.

    Is that what this possibility in LabView? Y at - it these LabView vi, which offers this feature? (Excerpts)?

    So I ask you:

    I want to create a switch/case (structure-case) block in labview for this code:

    If (String.StartsWith ("XYZ")) step in case1

    another step if (string.startswith ("DEF")) in CAS2

    ...

    BTW:

    It would be great if someone could create polymorphic VI with these functions:

    (from c# string class)

    public object Clone();
    public static int Compare (string strA, string strB);
    public static int Compare (string strA, string strB, Boolean ignoreCase);
    public static int Compare (string strA, strB string, StringComparison comparisonType.greater);
    public static int Compare (string strA, string strB, Boolean ignoreCase, CultureInfo culture);
    public static int Compare (string strA, string strB, CultureInfo culture, CompareOptions options);
    public static int Compare (string strA, int indexed, string strB, indexB int, int length);
    public static int Compare (string strA, int indexed, string strB, indexB int, int length, Boolean ignoreCase);
    public static int Compare (string strA, int indexed, string strB, indexB int, int length, StringComparison comparisonType.greater);
    public static int Compare (string strA, int indexed, string strB, indexB int, int length, Boolean ignoreCase, CultureInfo culture);
    public static int Compare (string strA, int indexed, string strB, indexB int, int length, CultureInfo culture, CompareOptions options);
    public static int CompareOrdinal (string strA, string strB);
    public static int CompareOrdinal (string strA, int indexed, string strB, indexB int, int length);
    public int CompareTo (object value);
    public int CompareTo (string strB);
    Public Shared Function Concat (IEnumerable values );
    public static string Concat(IEnumerable values);
    Public Shared Function Concat (object arg0);
    public static string Concat (params object [] args);
    Public Shared Function Concat (params string [] values);
    Public Shared Function Concat (object arg0, object arg1);
    Public Shared Function Concat (string str0, string str1);
    public static string Concat (object arg0, object arg1, object arg2);
    Public Shared Function Concat (string str0, string str1, string str2);
    public static string Concat (object arg0, object arg1, arg2, object arg3);
    public static string Concat (string str0, string str1, str2, string, string str3);
    public boolean Contains (string value);
    Public Shared Function Copy (string str);
    public final void CopyTo (int sourceIndex, destination of char [], int destinationIndex, int count);
    public boolean EndsWith (string value);
    public boolean EndsWith (value string, StringComparison comparisonType.greater);
    public boolean EndsWith (string value, Boolean ignoreCase, CultureInfo culture);
    public boolean Equals (object obj);
    public boolean Equals (string value);
    public static Boolean Equals (String, b string);
    public boolean Equals (string, StringComparison comparisonType.greater value);
    public static Boolean Equals (string a, b string, StringComparison comparisonType.greater);
    Public Shared Function Format (string format, object arg0);
    Public Shared Function Format (string format, params object [] args);
    Public Shared Function Format (IFormatProvider provider, format of the string, params object [] args);
    Public Shared Function Format (string format, object arg0, object arg1);
    Public Shared Function Format (string format, object arg0, object arg1, object arg2);
    public CharEnumerator GetEnumerator;
    public override int GetHashCode();
    public TypeCode GetTypeCode();
    public int IndexOf (char value);
    public int IndexOf (string value);
    public int IndexOf (char value, int startIndex);
    public int IndexOf (string value, int startIndex);
    public int IndexOf (string value, StringComparison comparisonType.greater);
    public int IndexOf (value char, int startIndex, int count);
    public int IndexOf (string value, int startIndex, int count);
    public int IndexOf (string value, int startIndex, StringComparison comparisonType.greater);
    public int IndexOf (string value, int startIndex, int count, StringComparison comparisonType.greater);
    public int IndexOfAny (char [] anyOf);
    public int IndexOfAny (char [], int startIndex anyOf);

    public int IndexOfAny (anyOf char [], int startIndex, int count);
    public string Insert (int startIndex, string value);
    Public Shared Function Intern (string str);
    public static IsInterned (string str);
    public boolean IsNormalized();
    public bool IsNormalized (NormalizationForm normalizationForm);
    public static Boolean IsNullOrEmpty (string value);
    public static Boolean IsNullOrWhiteSpace (string value);
    Public Shared Function Join (separator string, IEnumerable values);
    Public Shared Function Join(separator string, IEnumerable values);
    Public Shared Function Join (separator string, params object [] values);
    Public Shared Function Join (separator string, params string [] value);
    Public Shared Function Join (separator string, string [], int startIndex, int count);
    public int LastIndexOf (char value);
    public int LastIndexOf (string value);
    public int LastIndexOf (char, int startIndex value);
    public int LastIndexOf (string value, int startIndex);
    public int LastIndexOf (string value, StringComparison comparisonType.greater);
    public int LastIndexOf (value char, int startIndex, int count);
    public int LastIndexOf (string value, int startIndex, int count);
    public int LastIndexOf (string value, int startIndex, StringComparison comparisonType.greater);
    public int LastIndexOf (string value, int startIndex, int count, StringComparison comparisonType.greater);
    public int LastIndexOfAny (char [] anyOf);
    public int LastIndexOfAny (char [], int startIndex anyOf);
    public int LastIndexOfAny (anyOf char [], int startIndex, int count);
    public string Normalize();
    public string Normalize (NormalizationForm normalizationForm);
    public string PadLeft (int totalWidth);
    public string PadLeft (totalWidth int, char paddingChar);
    public string PadRight (int totalWidth);
    public string PadRight (totalWidth int, char paddingChar);
    public string Remove (int startIndex);
    public string Remove (int startIndex, int count);
    public string Replace (char oldChar, char newChar);
    public string Replace (string oldValue, string newValue);
    public string [] Split (params char [] separator);
    public string [] Split (separator char [], int count);
    public string [] Split (char [], StringSplitOptions options separator);
    public string [] Split (String [], StringSplitOptions options separator);
    public string [] Split (char [], int count, StringSplitOptions options separator);
    public string [] Split (String [], int count, StringSplitOptions options separator);
    public boolean StartsWith (string value);
    public boolean StartsWith (value string, StringComparison comparisonType.greater);
    public boolean StartsWith (string value, Boolean ignoreCase, CultureInfo culture);
    public string Substring (int startIndex);
    public string Substring (int startIndex, int length);
    public char [] ToCharArray();
    public char [] ToCharArray (int startIndex, int length);
    public string ToLower();
    public string ToLower (CultureInfo culture);
    public string ToUpperInvariant();
    Public Overrides Function ToString();
    public string ToString (IFormatProvider provider);
    public string ToUpper();
    public string ToUpper (CultureInfo culture);
    public string ToUpperInvariant();
    public string Trim();
    public string Trim (params char [] trimChars);
    public string TrimEnd (params char [] trimChars);
    public string TrimStart (params char [] trimChars);

    So I ask you:

    I want to create a switch/case (structure-case) block in labview for this code:

    This can be done already with the structure of the case, you can make simple analysis in the case selector, which takes a string as input.

    Type in the case of the first case "XYZ".... "XYZ".

    Enter the next case "DEF".... "DEF ~".

    Next is the empty string, the default value.

    How does this work:

    The "XYZ...". "XYZ ~ ' matches all strings that begin with XYZ and any ascii value after the ~ is the highest value printable 7-bit ascii for that catches all the other characters.

    Option 2 is parse (there is expression reg very good vi in the channel palette) the string and create if a corresponding to the value of the integer can habdle unique integers in the structure of the case.

    There are so many ways to do it without a wrapper for the string .net class, I have provided some quick methods

  • need help with a regexp

    I would like to extract all the digits in a string delimited by a point, possibly using string.split(). My abilities in writing expressions good regulare is simply not there, any help would be much appreciated
    String regexp = "";
    String s="this should result in nothing. Nothing at all."; 
    s.split(regexp); //result: {}
    s="50"; 
    s.split(regexp); //result: {"50"} 
    s="11.5000.25"; 
    s.split(regexp); //result: {"11","5000","25"}
    s="50x"; 
    s.split(regexp); //result: {}
    s="11.500x.25";
    s.split(regexp); //result: {}

    The best I can do is

          String[] splitS = s.matches("(?:\\d+\\.)*\\d+")? s.split("\\."):new String[0];
    
  • divide the data into lines

    Hello

    I have data like this.


    Person_wid industry

    111 car; Telecom


    How to divide as below


    Output:

    Auto 111

    Telecom 111


    Thank you


    SQL > test as

    () 2

    3 select person_wid 111, ' car. Telecom' double industry

    4)

    5. Select person_wid

    regexp_substr 6, (industry, ' [^;] +', 1, rn) split

    7 test

    8 cross

    9 join (select rownum rn

    10 in (select max (length (regexp_replace (industry, ' [^;] +'))) + 1 mx)

    11 test

    12                 )

    13 connect by level<=>

    14         );

    SPLIT PERSON_WID

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

    Auto 111

    Telecom 111

    2 selected lines.

    Notes on the Oracle: split delimited by a comma the way of RegExp string, second part

  • CSV to lines question please

    Hello

    I have a csv list, but I want the csv in rows, something like that - any help is greatly appreciated.

    Oracle Database 11 g Enterprise Edition Release 11.2.0.2.0 - 64 bit Production

    WITH t

    AS (SELECT "a" id, 1, 2, 3, 4' ordr FROM DUAL)

    UNION

    ID to SELECT 'b', ' 1, 2, 3, 4, 5' ordr FROM DUAL

    UNION

    SELECT 'c' id, 7, 8' ordr FROM DUAL)

    SELECT *.

    T

    want to the result like this-

    ID - ordr

    a 1

    a 2

    a 3

    a 4

    b 1

    b 2

    b 3

    b 4

    b 5

    c 7

    c 8

    Thank you very much.

    Here's how:

    Notes on the Oracle: split delimited by a comma the way of RegExp string, second part

    SQL > WITH t AS (SELECT 'a' id, ordr ' 1, 2, 3, 4' UNION DOUBLE)

    2 id SELECT 'b', ordr ' 1, 2, 3, 4, 5' OF the UNION DOUBLE

    3. SELECT 'c' id, 7, 8' ordr FROM DUAL)

    4. select id

    5, regexp_substr (ordr, ' [^,] +', 1, rn) split

    6 t

    7 cross join (select rownum rn

    8 in (select max (length (regexp_replace (ordr, ' [^,] +'))) + 1 mx)

    9                      from   t

    10                    )

    11. connect by level<=>

    12             )

    where the 13 regexp_substr (ordr, ' [^,] +', 1, rn) is not null

    14 order of 1,2;

    I SHARED

    - ---------

    a 1

    a 2

    a 3

    a 4

    b 1

    b 2

    b 3

    b 4

    b 5

    c 7

    c 8

    11 selected lines.

  • Transform XMLTYPE works differently in Oracle 10.1 and 11.2

    We are migrating our applications to Oracle 10.1 g to 11.2 g. We have a number of routines of PL/SQL that transform the incoming/outgoing XML using the XMLType Transform method. XSLT transformations that we use doesn't seem to work at 11.2. For example, the code below is a simplification of what we do. This code example uses the coded entrance to irreversibly and xslt to illustrate this point. The same code has very different results when operating in 10.1 and 11.2. In 10.1, the work of transformation. He was also using files in an xml tool. 11.2, none of the input XML is transformed. The only exit is the extra < sd:StandardBusinessDocument... which is hard-coded in the xslt as a wrapper.

    For example

    {code}

    declare

    out_sbd xmltype: = xmltype ("< OT_SBD_HEADER >

    < HEADER_VERSION > 1.0 < / HEADER_VERSION >

    SENDERS <>

    < OT_SENDER_RECEIVER >

    COGSD < ID > < / IDENTIFIER >

    < IDENTIFIER_AUTHORITY > urn:olgr.qld.gov.au:cogs < / IDENTIFIER_AUTHORITY >

    < / OT_SENDER_RECEIVER >

    < / SENDERS >

    <>RECEIVERS

    < OT_SENDER_RECEIVER >

    PORTAL of < ID > < / IDENTIFIER >

    < IDENTIFIER_AUTHORITY > urn:olgr.qld.gov.au: portal < / IDENTIFIER_AUTHORITY >

    < / OT_SENDER_RECEIVER >

    < / RECEIVERS >

    < DOCUMENT_INDENTIFICATION >

    urn:olgr.qld.gov.au < STANDARD > < / STANDARD >

    < TYPE_VERSION > 1.1 < / TYPE_VERSION >

    < INSTANCE_IDENTIFIER > c11ab0c6-22e7-4132-88f8-f81e88cde75c < / INSTANCE_IDENTIFIER >

    licenceInformation < TYPE > < / TYPE >

    < CREATION_DATE > 2012-05-30T 13: 55:41.167125 + 10:00 < / CREATION_DATE >

    < / DOCUMENT_INDENTIFICATION >

    < BUSINESS_SCOPE >

    < OT_SBD_HEADER_SCOPE >

    get < SCOPE_TYPE > < / SCOPE_TYPE >

    < SCOPE_INSTANCE_IDENTIFIER > GET_GAMING_STATISTICS_DATA < / SCOPE_INSTANCE_IDENTIFIER >

    < / OT_SBD_HEADER_SCOPE >

    < / BUSINESS_SCOPE >

    (< / OT_SBD_HEADER > ');

    --

    transformed_out_sbd xmltype.

    --

    sbd_header_out_xslt xmltype: = xmltype (' <? xml version = "1.0" encoding = "ISO-8859-1"? >)

    <!--

    This file was generated by Altova MapForce 2011r2sp1

    YOU MUST NOT CHANGE THIS FILE, BECAUSE IT WILL

    OVERWRITTEN WHEN YOU RE-RUN OF THE CODE GENERATION.

    See Altova MapForce Documentation for more details.

    http://www.Altova.com/MapForce

    ->

    " < xsl: stylesheet version ="1.0"xmlns: xsl = ' http://www.w3.org/1999/XSL/transform "" xmlns: XS = " " http://www.w3.org/2001/XMLSchema "exclude-result-prefixes ="xs"> "

    < xsl: output method = "xml" encoding = "UTF-8" Indent = "yes" / >

    < xsl: template match = "/" >

    " < sd:StandardBusinessDocument xsi: schemaLocation =" http://www.UNECE.org/CEFACT/namespaces/StandardBusinessDocumentHeader "' sbd.xsd ' xmlns:sd = ' http://www.UNECE.org/CEFACT/namespaces/StandardBusinessDocumentHeader "" xmlns: xsi = " " http://www.w3.org/2001/XMLSchema-instance ">

    < xsl: select = "* [local - name () = foreach & apos;" OT_SBD_HEADER & apos; and namespace - uri () = & apos; & apos;] ">

    < name of xsl: variable = "var1_DOCUMENTINDENTIFICATION" select = "* [local - name () = & apos;" DOCUMENT_INDENTIFICATION & apos; and namespace - uri () = & apos; & apos;] "/ >

    < name of xsl: variable = "var2_MANIFEST" select = "* [local - name () = & apos;" MANIFESTO & apos; and namespace - uri () = & apos; & apos;] "/ >

    < name of xsl: variable = "var3_resultof_cast" select = "string ($var1_DOCUMENTINDENTIFICATION / * [local - name () = & apos;)" MULTIPLE_TYPE & apos; and namespace - uri () = & apos; & ;]) "/ >

    < StandardBusinessDocumentHeader >

    < HeaderVersion >

    < xsl: value - of select = "string (HEADER_VERSION)" / >

    < / HeaderVersion >

    < xsl: for-each select = "SHIPPERS" >

    < name of xsl: variable = sΘlectionner "var4_OTSENDERRECEIVER" = "OT_SENDER_RECEIVER" / >

    sender <>

    <>identifier

    < xsl: attribute name = "Authority" >

    < xsl: value - of select = "string($var4_OTSENDERRECEIVER/IDENTIFIER_AUTHORITY)" / >

    < / xsl: attribute >

    < xsl: value - of select = "string($var4_OTSENDERRECEIVER/IDENTIFIER)" / >

    < / identifier >

    < / sender >

    < / xsl: foreach >

    < xsl: for-each select = 'RECEIVERS' >

    < name of xsl: variable = sΘlectionner "var5_OTSENDERRECEIVER" = "OT_SENDER_RECEIVER" / >

    < receiver >

    <>identifier

    < xsl: attribute name = "Authority" >

    < xsl: value - of select = "string($var5_OTSENDERRECEIVER/IDENTIFIER_AUTHORITY)" / >

    < / xsl: attribute >

    < xsl: value - of select = "string($var5_OTSENDERRECEIVER/IDENTIFIER)" / >

    < / identifier >

    < / receiver >

    < / xsl: foreach >

    < DocumentIdentification >

    < standard >

    < xsl: value - of select = "string($var1_DOCUMENTINDENTIFICATION/STANDARD)" / >

    < / standard >

    < TypeVersion >

    < xsl: value - of select = "string($var1_DOCUMENTINDENTIFICATION/TYPE_VERSION)" / >

    < / TypeVersion >

    < InstanceIdentifier >

    < xsl: value - of select = "string($var1_DOCUMENTINDENTIFICATION/INSTANCE_IDENTIFIER)" / >

    < / InstanceIdentifier >

    < type >

    < xsl: value - of select = "string($var1_DOCUMENTINDENTIFICATION/TYPE)" / >

    < / type >

    < MultipleType >

    < xsl: value-of select = "string (((normalize-space ($var3_resultof_cast) = & apos; true & apos ;) or (normalize-space ($var3_resultof_cast) = & apos; 1 & apos ;)))" / > ")))"

    < / MultipleType >

    < CreationDateAndTime >

    < xsl: value - of select = "string($var1_DOCUMENTINDENTIFICATION/CREATION_DATE)" / >

    < / CreationDateAndTime >

    < / DocumentIdentification >

    <>Manifesto

    < NumberOfItems >

    < xsl: value - of select = "string ((string($var2_MANIFEST/NUMBER_OF_ITEMS)))" / >

    < / NumberOfItems >

    < xsl: for-each select = "$var2_MANIFEST/MANIFEST_ITEMS" >

    < name of xsl: variable = sΘlectionner "var6_OTMANIFESTITEM" = "OT_MANIFEST_ITEM" / >

    < ManifestItem >

    < MimeTypeQualifierCode >

    < xsl: value - of select = "string($var6_OTMANIFESTITEM/MIME_TYPE)" / >

    < / MimeTypeQualifierCode >

    < UniformResourceIdentifier >

    < xsl: value - of select = "string($var6_OTMANIFESTITEM/RESOURCE_IDENTIFIER)" / >

    < / UniformResourceIdentifier >

    < description >

    < xsl: value - of select = "string($var6_OTMANIFESTITEM/DESCRIPTION)" / >

    < / description >

    < / ManifestItem >

    < / xsl: foreach >

    < / manifesto >

    < xsl: for-each select = "BUSINESS_SCOPE" >

    < name of xsl: variable = sΘlectionner "var7_OTSBDHEADERSCOPE" = "OT_SBD_HEADER_SCOPE" / >

    < BusinessScope >

    < scope >

    < type >

    < xsl: value - of select = "string($var7_OTSBDHEADERSCOPE/SCOPE_TYPE)" / >

    < / type >

    < InstanceIdentifier >

    < xsl: value - of select = "string($var7_OTSBDHEADERSCOPE/SCOPE_INSTANCE_IDENTIFIER)" / >

    < / InstanceIdentifier >

    <>identifier

    < xsl: value - of select = "string($var7_OTSBDHEADERSCOPE/SCOPE_IDENTIFIER)" / >

    < / identifier >

    < / scope >

    < / BusinessScope >

    < / xsl: foreach >

    < / StandardBusinessDocumentHeader >

    < / xsl: foreach >

    < / sd:StandardBusinessDocument >

    < / xsl: template >

    < / xsl: stylesheet >

    ');

    --

    --

    BEGIN

    transformed_out_sbd: = out_sbd.transform (sbd_header_out_xslt); -using the above hard coded XSLT to transform out_sbd

    --

    INSERT INTO z_clob_log (id, clob_name, clob_desc, clob_doc) - connect the output to a clob column in a table

    SELECT (select nvl (max (id), 0) + 1 _clob_log).

    TO_CHAR (sysdate, 'YYYYMMDD hh24:mi:ss') |' -CHANGED OUT_SBD',.

    transformed_out_sbd.getClobVal

    DOUBLE;

    COMMIT;

    END;

    {code}

    10.1, the output is as expected, the same thing that do the transformation using files in an xml tool.

    {code}

    " < sd:StandardBusinessDocument xsi: schemaLocation =" http://www.UNECE.org/CEFACT/namespaces/StandardBusinessDocumentHeader "' sbd.xsd ' xmlns:sd = ' http://www.UNECE.org/CEFACT/namespaces/StandardBusinessDocumentHeader "" xmlns: xsi = " " http://www.w3.org/2001/XMLSchema-instance ">

    < StandardBusinessDocumentHeader >

    < HeaderVersion > 1.0 < / HeaderVersion >

    sender <>

    < Authority = "identifier urn:olgr.qld.gov.au:cogs" > COGSD < / identifier >

    < / sender >

    < receiver >

    < Authority = "urn:olgr.qld.gov.au: portal identifier" > PORTAL < / identifier >

    < / receiver >

    < DocumentIdentification >

    urn:olgr.qld.gov.au < standard > < / Standard >

    < TypeVersion > 1.1 < / TypeVersion >

    < InstanceIdentifier > c11ab0c6-22e7-4132-88f8-f81e88cde75c < / InstanceIdentifier >

    licenceInformation < type > < / Type >

    < MultipleType > false < / MultipleType >

    < CreationDateAndTime > 2012-05-30T 13: 55:41.167125 + 10:00 < / CreationDateAndTime >

    < / DocumentIdentification >

    <>Manifesto

    < NumberOfItems / >

    < / manifesto >

    < BusinessScope >

    < scope >

    get < type > < / Type >

    < InstanceIdentifier > GET_GAMING_STATISTICS_DATA < / InstanceIdentifier >

    < identifier / >

    < / scope >

    < / BusinessScope >

    < / StandardBusinessDocumentHeader >

    < / sd:StandardBusinessDocument >

    {code}

    11.2, none of the original xml document is included in the output, only the < sd: StandardBusinessDocument... / >

    {code}

    " < sd:StandardBusinessDocument xsi: schemaLocation =" http://www.UNECE.org/CEFACT/namespaces/StandardBusinessDocumentHeader "' sbd.xsd ' xmlns:sd = ' http://www.UNECE.org/CEFACT/namespaces/StandardBusinessDocumentHeader "" xmlns: xsi = " " http://www.w3.org/2001/XMLSchema-instance "/>

    {code}

    The same happens using the SQL XMLTransform function, for example apply what follows with the above xml and xslt, except that it generates a separate closing tag < / sd:Standard... >

    Select xmltransform (out_sbd, sbd_header_out_xslt) in double transformed_out_sbd;

    Q: any ideas? Are there changes in 11g 11.2 requiring major changes to xslt?

    We have a lot of rewriting for this if we can't get this to work!

    Hi Eduardo,

    Report it as a bug to the Support of Oracle.

    The problem lies in the function namespace - uri (): comparison with an empty string is not resolved properly, so no node is still selected in the first xsl: for each.

    If you need a workaround solution, there are some that you can test:

    (1) if the entry documents are actually in no namespace (for example, in your example), delete all occurrences namespace - uri () of the style sheet.

    (2) in the opposite direction, you can give your document of entry a dummy namespace and now referenced in the style sheet. The namespace - uri () test will work in this case.

    (3) replace the occurrences of namespace - uri () by a somewhat more elaborate test that will handle namespace empty in particular, for example:

    (namespace-uri () = $nsuri or (not ($nsuri) and not (namespace - uri ()))

    Given that you work with generated style sheets, I understand that none of the options above are really satisfactory.

    If I had to work around the problem, I would probably go with the 2nd option which involves a smaller amount of refactoring.

  • list by commas must be build as a table using the existing table column

    Hi all

    I have table with a comma separate value, column container

    Select 1 emp_id, edu 'BSc, MCA' double

    Union of all the

    Select 2 Emp_id, 'b.SC., MBA' double

    Union all

    Select 3 Emp_id, 'Bsc, MEd' of the double

    and I need to replace as follows

    Emp_id edu

    1                  BSc

    1                  MCA

    2                  BSc

    2                  MBA

    3                  Bsc

    3                  MEd

    How to achieve...

    Iqbal

    Notes on the Oracle: split delimited by a comma the way of RegExp string, second part

  • Validate numbers and characters in a form field.

    Hi all

    I have created a form and in it, there are e-mail and phone number fields.

    I found http://forums.adobe.com/thread/857974

    to be really useful to help me validate my email field.

    Then I tried to tweak for the phone number field I need to allow only characters 1234567890 +)

    As you can see, the number of his just and + (). How to restrict the field to only accept characters?

    I tried but it failed:

    Custom text field validation script

    (function () {}

    var val = String (event.target.value);

    Do nothing if the field is empty

    If (! val) return;

    If the value is not a phone number valid...

    If (! val.match (/ \ +?)) [ 0-9\(\)]*/)) {

    .. .that the user knows that the value is not a valid phone number...

    App.Alert ("Please enter a phone number, for example + 012 (3) 123123123", 3 ");

    .. .and set the focus on this field

    event.target.setFocus ();

    }

    })();

    But it does not work. Sigh.

    I have 0 training in computer language (I am a biologist, and this is a form for doctors to fill with data of patients) and would appreciate your help in getting the work phone field validation.

    Thank you!

    Try this script:

    function validate (telephone) {}

    var regex = /^(\+) ((?: [0-9]?) 6.14 {[0-9]) $/;

    If (regex.test (phone)) {}

    Valid international phone number

    return the RegExp. $1 + "" + RegExp. $2;

    } else {}

    Invalid international phone number

    Return ' ';

    }

    }

    If (event.value! = "") {}

    Event.Value = validate (event.value);

    If (event.value == "") {}

    App.Alert ("Please enter a valid + 1 international phone 12(3) 123123 number\n (12312)") ", 1, 0);

    Event.RC = false;

    }

    } / / end of non-null field value

    Note it is a validation script and runs only when you leave a field. If you want to check hits then you will need to use the custom keystroke script and you can use this code as a starting point, but you will need change the format RegExp string to test every keystroke as it is typed.

  • Read and write in a PARAM. CMI file?

    Hello

    I have a problem with the reading and writing of a PARAM. CMI file. If I remove the "Section" block at the top and move the first element to the top, I can read very well but I can't get past the sections.

    Section ex: "[Core]" if I delete that and everything move upwards no problemo. Any help would be appreciated.

    Yes. Oops. It was the air code. You would use URLLoader and URLRequest instead of FileStream and file. My bad. For example, if you have done the URLRequest thing and got your file in a first function URLLoader I gave you become:

    private void loadCMIFile(evt:Event):void {}

    var cmiLoader:URLLoader = evt.currentTarget as URLLoader;

    try {}

    parseCMI (cmiLoader.data);

    } catch (err: error) {}

    trace (err.name, "\rUnable to parse the selected file." + err.message);

    }

    var lessonStatus:String = "Lesson_Status."

    trace (CMI [lessonStatus]);

    }

    Just parsing the text, we can make an object or an XML in flash that contains the data in a readable way, but if you want to rebuild the IJC to Flash file so you will need to know what these headers. I mean if there is no information and they are not text, you will need to know the number of bytes that they are and then put aside in a ByteArray so that you can transfer them on your later output file. Or you need to find the specifications of file for them - they could be full of location bytes or ID tags or who knows.

    Assuming that we have to fear is the analysis, I would like to make a suggestion. Maybe you want your data to a XML in Flash:

    private var cmiXML:XML =

    ...

    ...

    To save time to look for keywords, you can configure a set of vectors that contain

    private const cmiCore:Vector. = new ["Student_ID', 'Student_Name',"Output_File"... etc.];

    private const cmiCoreVendor:Vector. = new ["CoursePath"];

    private const cmiEvaluation:Vector. = new ["Course_ID', 'Comments_File', 'Objectives_Status_File'];

    etc...

    Then you can read like this:

    private void parseCMI(string:String):void {}

    analyze the main

    for (var i: int = 0; i< cmicore.length;="" i++="">

    var regExp:RegExp = new RegExp (cmiCore [i] + "=");

    If (regExp.test (string) {}

    cmiXML.core.child (cmiCore [i]) = extract (string, regExp);

    }

    ]

    }

    private void extract(str:String,_re:RegExp):String {}

    var value: String = str.substr (str.search (re));                    makes a string that starts after the "equal" sign

    value = value.substring(0,value.search(/[\r\n]/);           cut the string at the first jump of line or return transport

    Returns the value;

    }

  • in the regular expression non-pl/sql variable

    Hello again people.

    Wondering just if possible to pass a value of variable column in the regexp_substr model? Given: column_value = 123
    RegExp (string, pattern), where the model includes column_value? column_value can change at any time according to the value of the column in the table.

    Thank you!

    Published by: user11922215 on August 16, 2010 20:20

    Published by: user11922215 on August 16, 2010 20:21

    Hello

    Of course, you can use variables like this.
    By example, to see if x precedes y in one ',' - list delimited:

    REGEXP_LIKE ( string
             , ','      ||
               x          ||
               ',.*,'     ||
               y          ||
               ','
             )
    

    x and there can be any kind of expression that reutrns one string, including the columns, function calls and expressions BOX.

  • manipulating strings (regexp) function?

    Hello

    I'm trying to extract several elements of a string and concatenate them in another string with a delimiter.

    Example of

    entry: UV23_I2_P0_NUM > UV23_I2_P1_NUM AND UV23_I2_P1_NUM > UV23_I2_P2_NUM AND UV24_I4_P0_TXT = 'YES'

    output: UV23_I2_P0_NUM; UV23_I2_P1_NUM; UV23_I2_P1_NUM; UV23_I2_P2_NUM; UV24_I4_P0_TXT


    In short: extract the UV bits a concatenation of them in a new string... operators and other stuff should not be in the new channel.
    Everyone knows a function that does this?

    Note: the pieces I want to keep always begin with UV and end with NUM or TXT.
    I already watched the regexp function but its just not really all that me...
    My database is 10g R2

    Thank you!

    Hello

    It works on the sample data your posted:

    SELECT     TRIM ( BOTH  ';'
                FROM  REGEXP_REPLACE ( str
                                         , '(^|NUM|TXT)(.*?)(UV|$)'
                            , '\1;\3'
                            )
              )     AS new_str
    FROM    table_x
    ;
    

    It may need some adjustments to handle special situations (for example, perhaps, UV which is not followed by NUM or TXT).

    >
    I already watched the regexp function but its just not really all that me... What an understatement! I have never met anyone who regular expressions were obvious. As hard as possible to learn, however, they are well worth.

  • Another REGEXP question: how to extract multiple values from a string

    Hi, how can I retrieve multiple values to a string with RegExp with Oracle SQL constructs?

    Have looked at the various examples, I cannot understand this.
    the following Sql code
    select
       regexp_substr(sessie."rollen", 'CN=A_role') "A_role"
       from ( 
    select '
    CN=A_role,OU=a_org_unit,OU=another_org_unit,DC=bz,DC=ad,DC=min,DC=local
    CN=Another_role,OU=some_org_unit,DC=bz,DC=ad,DC=min,DC=local
    CN=Users,OU=Dep,DC=bz,DC=ad,DC=min,DC=local
    '   "rollen" from dual
    ) sessie;
    Returns CN = A_role.
    I want him back all of the CN = concatenated values with a semicolon and stripped of the CN = bit.
    So: A_role; Another_role; Users .

    Any help would be much appreciated. Here I use database 11g 11.2.0.2.0.

    Does anyone have an idea how to do this in SQL?

    best regards Mike

    Hello
    If using Oracle 11 g

    with tst
      as (select   'CN=A_role,OU=a_org_unit,OU=another_org_unit,DC=bz,DC=ad,DC=min,DC=local,'
                 ||'CN=Another_role,OU=some_org_unit,DC=bz,DC=ad,DC=min,DC=local,'
                 ||'CN=Users,OU=Dep,DC=bz,DC=ad,DC=min,DC=local' as rollen
            from dual
          )
    select listagg(sub, ',') within group (order by rn) as res
      from (select regexp_substr(rollen, '(CN=)([[:alnum:]_]+)',1,rownum,'i',2) sub, rownum rn
              from tst
           connect by level <=length(rollen)
           )
     where sub is not null       
    
  • RegExp - white string trim extra space

    Hello
    I am trying to parse a string in order to remove all the extra white space.

    I work in AS3 and for the moment the only model that remove all content, I found:

    field.text = field.text.replace ("\A\s+|\s+\z", " ");


    I want to treat the case as "My Name" and change it to 'My Name'.

    Any help?
    Concerning

    It's actually an interesting question.  But I think that the answer would still be 2 part, because you can't State in your replacement for more than 1 option such as a switch or ElseIf.

    var myRegExp:RegExp = / {1,} /gi

    This expression will get rid of all the spaces greater than 1, which means that it leaves a space at the beginning and a space at the end, but at the end of the day, you can follow upward with the expression you already have.

  • Find several occurrence of a dynamic string using RegExp?

    I need to find multiple instances (there can only be one) of a dynamic text. For example

    var searchForThis:String = 'hi. '

    var regEx: RegExp = \b/searchForThis/\b

    The above does actually not compile and if I remove the two \b he actually seek the word searchForThis and not salvation.

    (1) how can I configure RegExp to search for a word not only a substring that is dynamic and can find multiple occurrences as well as the index at the beginning of each event?   So, if I had the string "Hi there by there salvation once again. Where is the road"he would find two matches. He wouldn't understand road because this salvation is just a substring. I would be looking for the words

    With the next component, I find the three games in the list when I click the button of "game". It does not give you the match index, even if - depending on what you plan to do, String.replace () could work (the replacement of the game can be a string or a function that is passed to a certain number of arguments, including the index of matches).


    http://www.Adobe.com/2006/mxml"width ="400"height ="300">
       
            private var v: String = "Hi there by there Hi there Jake."
    private var re: RegExp = new RegExp ("Hi", "g");
               
    private void handleClick(e:Event):void {}
    var matches: Array = v.match (re);
    matchList.dataProvider = matches;
    }
               
    ]]>
       

       
       

Maybe you are looking for