Regex query

How can i get result where first name is same as last name using
regex pattern matching.

Yes, \b matches a word boundary, which is defined as a position that is either preceded by a word character and not followed by one, or followed by a word character and not preceded by one. Since we know the second \b is preceded by a word character, the next character (if there is one) has to be a non-word character. But the \1 has to match the same thing as the \w+ did, which means the next character can only be a word character.
To match the same "word"[*] twice, you have to match at least one intervening non-word character: \b(\w+)\W+\1\b With the \W+ in there, the second \b from the original regex is redundant. However, there needs to be another one after the \1 to ensure that the second word, like the first, isn't really part of a longer word.
[*] By "word" I mean one or more word characters as defined by most regex flavors, i.e., [A-Za-z0-9_]. Matching real, natural-language words is a much more complicated task, not well suited to regexes.

Similar Messages

  • RegEx Query - non alpha numeric characters

    Hi,
    On our Oracle EBS system users can paste data into the system and "strange" characters are not trapped, therefore they can paste into forms from e.g. word and include non standard characters. Sorry if that sounds vague.
    I need to be able to find the non alphanumeric chars in a table which are "breaking" an interfaced system which takes data from Oracle and puts some of it into an XML file. Other valid characters we don't have a problem with are e.g.
    !"£$%^&*()_+-=[{]};:'@,<.>/?\|
    For example, I know one character that causes a problem is the character MS Word uses to replace a dash.
    e.g. if I type:
    *this - that*
    Word changes it to:
    *This – that*
    That's a character I can't type on my keyboard, and an example of a character I'd like to be able to find using SQL.
    There are probably others, but all I would like to do is to find "non standard" characters.
    I have one sample transaction ID I know contains the funny MS dash, so this SQL returns it:
    SELECT pec.expenditure_comment
      FROM pa.pa_expenditure_comments pec
    WHERE REGEXP_LIKE (pec.expenditure_comment
                      , '(^ )|[^[:alnum:] &!"£$%^()_+=-{};:@#~,<.>/?\|]')
       AND pec.expenditure_item_id = 6445260However, it also returns other records which don't contain funny characters, so I don't think it is working correctly.
    Hence me asking for advice here. Any assistance would be much appreciated.
    Thanks

    966480 wrote:
    Hi,
    On our Oracle EBS system users can paste data into the system and "strange" characters are not trapped, therefore they can paste into forms from e.g. word and include non standard characters. Sorry if that sounds vague.
    I need to be able to find the non alphanumeric chars in a table which are "breaking" an interfaced system which takes data from Oracle and puts some of it into an XML file. Other valid characters we don't have a problem with are e.g.
    !"£$%^&*()_+-=[{]};:'@,<.>/?\|Are the square bracket characters, '[' and ']' acceptable? The code you posted below doesn't allow them.
    For example, I know one character that causes a problem is the character MS Word uses to replace a dash.
    e.g. if I type:
    *this - that*
    Word changes it to:
    *This – that*
    That's a character I can't type on my keyboard, and an example of a character I'd like to be able to find using SQL.
    There are probably others, but all I would like to do is to find "non standard" characters.Thee are some built-in character classes, such as [:print:] and [:graph:], that might make this job a little simpler for you.
    I have one sample transaction ID I know contains the funny MS dash, so this SQL returns it:
    SELECT pec.expenditure_comment
    FROM pa.pa_expenditure_comments pec
    WHERE REGEXP_LIKE (pec.expenditure_comment
    , '(^ )|[^[:alnum:] &!"£$%^()_+=-{};:@#~,<.>/?\|]')
    AND pec.expenditure_item_id = 6445260
    The hyphen character ( '-' ) has a special meaning inside square brackets. If you want to include a literal hyphen in the set, then put it at the very beginning (right after the '[') or the very end (right before the ']'); for example:
      WHERE REGEXP_LIKE (pec.expenditure_comment
                       , '(^ )|[^[:alnum:] &!"£$%^()_+={};:@#~,<.>/?\|-]')
    {code}
    The right square bracket, ']', also has a special meaning: it ends the set.  If you want to include a literal right ']' in the set, it must be the very first character.  The following code does not find the square brackets funny:
    {code}
      WHERE REGEXP_LIKE (pec.expenditure_comment
                       , '(^ )|[][^[:alnum:] &!"£$%^()_+={};:@#~,<.>/?\|-]')
    However, it also returns other records which don't contain funny characters, so I don't think it is working correctly.The query you posted, and both of my suggestions, will pick strings that start with a space, whether or not any funny characters come later. If you want to accept strings whether or not they start with spaces (just so long as they do not contain any funny characters) then lose the '(^ )|'; for example:
      WHERE REGEXP_LIKE (pec.expenditure_comment
                       , '[][^[:alnum:] &!"£$%^()_+={};:@#~,<.>/?\|-]')
    {code}
    >
    Hence me asking for advice here. Any assistance would be much appreciated.I hope that answers your question.
    If not, post some sample data (CREATE TABLE and INSERT statements) so people can re-create the problem and test their ideas.  Also post the correct results you want from the given sample data.
    Edited by: Frank Kulash on May 31, 2013 10:11 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • About regex and 'like' query

    Dear all,
    can i doing regex query in SAP B1?
    And how to use 'like' query with table, i mean :
    SELECT * FROM test T0 INNER JOIN test2 T1
    WHERE T0 LIKE '%T1.testfield%'
    thanks for your help

    wait - something came out funny in the previous posting - the system highlighted the name "field" with blue - that is NOT what I typed...
    instead I typed...
    "field" between two brackets ( bracket = [ and the other bracket - I cannot type them in because they come out as a different character)
    what the heck is going on with the forum here???  I am seeing this highlighting in other postings as well...
    Hope THIS one comes out correctly
    Edited by: Zal Parchem on Dec 29, 2007 2:47 PM

  • Handling '\' in reg exp query while integrating it in phython

    Hi,
    I am using the oracle 10g . I am trying to write a below mention sql regular expression in Python script. This query is working fine when I am running this in the sql developer (using it independently) However when I am trying to integrate the same inside Python script it doesn't do the required job. As per my Initial analysis this may be because in my regex query I have use '\' (in bold) which it is escaping because in log it is getting replaced by ^
    Actual Query_
    query = "UPDATE "+self.schema+";."+table_name+" SET SSR_FREE_TEXT=REPLACE(REGEXP_REPLACE(:1,'(\d{6})(\d{2,9})(\d{4})','\1X\3'), 'X', LPAD('X',LENGTH(SSR_FREE_TEXT) - LENGTH(REGEXP_REPLACE(SSR_FREE_TEXT,'(\d{6})(\d{2,9})(\d{4})','\1\3')),'X')) WHERE SSR_ID=:2"
    In log_
    UPDATE OWNADSSMOHANTHY_AIR_AY.SSR SET SSR_FREE_TEXT=REPLACE(REGEXP_REPLACE(:1,'(\d{6})(\d{2,9})(\d{4})','^AX^C'), 'X', LPAD('X',LENGTH(SSR_FREE_TEXT) - LENGTH(REGEXP_REPLACE(SSR_FREE_TEXT,'(\d{6})(\d{2,9})(\d{4})','^A^C')),'X')) WHERE SSR_ID=:2
    The use of this regexp is IF I have a value of IDCCCA5475129999998943 it should be replaced to IDCCCA547512XXXXXX8943
    Whereas when using in python it replaced the value to IDCCCAXXXXXXXXXXXXXXXX
    Could you please help me in resolving this
    Regards

    I do not know much about Python but can you look into this line:
    Other programming languages like .NET languages, Java, and Python instead provide regular expressions through standard libraries.
    Please refer:
    http://en.wikipedia.org/wiki/Regular_expression

  • Get Variant Attribute Should Search for and return multiple values based on RegEx

    I am using Variants as lookup tables (see this article):
    Using Variant Attributes to Build a Dictionary or Look-up Table
    I would like to be able to use some sort of wildcard to return multiple results from the Get Variant Attribute VI (all results are of the same type, and I don't know the exact names of all the results - those two points make this idea distinct from this idea: Set/Get Variant Attribute for Multiple Attributes).
    Ideally the wildcard would be RegEx.  If it were, the means by which you specify what to return is standardized.
    In the above example, there would be some ambiguity in terms of whether or not you would want to return a result or an array of results given an input, and I doubt you could detect and assume RegEx is what the programmer desires to use.  So I think this means a new input would be required to specify whether or not the "name" input of the Get Variant Attribute VI should be interpreted as a RegEx query.
     

    Why RegEx? Why not SQL query? Why not filename wildcard matching?
    I don't see anything that makes RegEx special. For this kind of functionality, the code that you've written seems like exactly the right way to do it rather than bolting a RegEx parser or any other system into the primitives or clouding the palette with a bunch of primitives to support various search functions. I could see a primitive that takes a VI refnum that has a conpane of string in/boolean out that you would pass in to supply the filter functionality that you want for any given application, but even that I'd lean toward just letting that be a library that someone writes on top of the primitives. Yes, there is some memory reduction that can be done if it is internal to the primitives, no question about that. But there are so many variations in how to do that filtration/sorting/etc that I'm not confident that any prim would cover a sufficient use case to be worth it. I could be wrong here ... let's see what other comments come in.

  • HTML character entities problem in saved regex search and replace query

    I have a many search and replace regular expression queries (.dwr files) that I have saved. I have a problem specifically with saved queries that contain HTML entities such as "& nbsp ; " or "& shy ;" (spaces added otherwise code doesn't render in browser). For example if I use the following search:
    ([\d]{3}& shy ;[\d]{3}& shy ;[\d]{4}|[\d]{3}& nbsp ;[\d]{3}& nbsp ;[\d]{4})
    (which searches for numbers in the 888-555-1234 or 888 555 1234 formats)
    This will work fine if I manually enter it into the search text area. However if I save it to file and reload it, it will no longer work because the &shy; and   characters are now displayed as " " (space) and "-"(shy) rendering the saved query useless as it's no longer searching for the code. I have some fairly long and complex queries and this is becoming a problem.
    Thanks for any help.
    I'm currently using Dreaweaver CS4 at home and CS5.5 at work.

    Thanks for your reply Kenneth, but that is not what I'm trying to accomplish. I'm looking for the HTML entities that exist in the source code which are & shy ; and & nbsp ; (without the spaces). As I mentioned above, if I enter them manually in the search box, I will get the corrrect results. If I save the search and then reload it, the special characters are no longer in HTML and the search is now useless.
    Just for example again
    In an open document in code view insert a number in the format (without the spaces): 888& nbsp;888& nbsp ;8888
    Open a search dialog box and enter (without the spaces): [\d]{3}& nbsp ;[\d]{3}& nbsp ;[\d]{4}
    The search will find that entry.
    Save search as phone.dwr for example. Then load it and try the search again. It won't work because upon loading the search Dreamweaver replaces the HTML code which was saved with the rendered HTML. So now the search shows up as: [\d]{3} [\d]{3} [\d]{4} which will not find the string with hard coded non-breaking spaces that I'm looking for.
    Basically I want to be able to save a search query for reuse. When I load a search query, I want it to be exactly what I saved, not something that DW has rendered (that doesn't work).

  • SQL Query for mapping a set of batches to a class rooms group

    Hi All,
    I am using Oracle 11g Release 2 database.
    I have the following data set:
    ClassRooms
    ClassId ClassName                    Capacity     Group
    1 Babbage/Software Engg Lab          24          1
    2     Basement - PG Block               63          1
    3     Classroom 1                    56          1
    4     Classroom 10                    24          1
    5     Classroom 11                    24          1
    6     Classroom 12                    35          1
    7     Classroom 13                    42          1
    8     Classroom 14                    42          1
    9     Classroom 15                    42          1
    10     Classroom 2                    35          1
    11     Classroom 3                    35          1
    12     Classroom 4                     35          1
    13     Classroom 5                    35          1
    14     Classroom 6                    25          1
    15     Classroom 7                    25          1
    16     Classroom 8                    24          1
    17     Classroom 9                    24          1
    18     Control Sys Lab                    24          1
    19     Dig & Embd Sys Lab               20          1
    20     DSP & Comm Lab                    20          1
    21     Electromechanical System Lab     28          1
    22     Farabi/Web Tech Lab               36          1
    23     Gen Purpose Lab                    40          1
    24     Shirazi/DB Tech Lab               36          1
    25     Adv Elect Lab                    30          2
    26     Classroom 16                    42          2
    27     Classroom 17                    49          2
    28     Classroom 18                    56          2
    29     Classroom 19                    42          2
    30     Classroom 20                    49          2
    31     Classroom 21                    35          3
    32     Classroom 22                    35          3
    33     MDA Lab                         20          3
    DegreeBatches
    BatchId      BatchName Strength
    1          BIT-11          79          
    2          BIT-12          28          
    3          BS(CS)-1          35          
    4          BS(CS)-2          78          
    5          BE(SE)-1          69          
    6          BE(SE)-2          84          
    7          BE(SE)-3          64          
    8          BICSE-7          84          
    9          BICSE-8          43          
    10          BEE-1          112          
    11          BEE-2          151          
    12          BEE-3          157          
    13          BEE-4          157          
    I want to map a degree batch combination to a class rooms group in such away that they fully utilize maximum capacity of the class rooms within a group (Ideal case) or as close to it as possible. Can it be done with a SQL query?
    Any response will be highly appreciated.
    SQL Scripts to generate the required tables and populate data is below:
    CREATE TABLE ClassRooms (ClassId NUMBER, ClassName     VARCHAR2(50), Capacity NUMBER, Group NUMBER);
    INSERT INTO ClassRooms VALUES(1,'Babbage/Software Engg Lab',24,1);
    INSERT INTO ClassRooms VALUES(2,'Basement - PG Block',63,1);
    INSERT INTO ClassRooms VALUES(3,'Classroom 1',56,1);
    INSERT INTO ClassRooms VALUES(4,'Classroom 10',24,1);
    INSERT INTO ClassRooms VALUES(5,'Classroom 11',24,1);
    INSERT INTO ClassRooms VALUES(6,'Classroom 12',35,1);
    INSERT INTO ClassRooms VALUES(7,'Classroom 13',42,1);
    INSERT INTO ClassRooms VALUES(8,'Classroom 14',42,1);
    INSERT INTO ClassRooms VALUES(9,'Classroom 15',42,1);
    INSERT INTO ClassRooms VALUES(10,'Classroom 2',35,1);
    INSERT INTO ClassRooms VALUES(11,'Classroom 3',35,1);
    INSERT INTO ClassRooms VALUES(12,'Classroom 4',35,1);
    INSERT INTO ClassRooms VALUES(13,'Classroom 5',35,1);
    INSERT INTO ClassRooms VALUES(14,'Classroom 6',25,1);
    INSERT INTO ClassRooms VALUES(15,'Classroom 7',25,1);
    INSERT INTO ClassRooms VALUES(16,'Classroom 8',24,1);
    INSERT INTO ClassRooms VALUES(17,'Classroom 9',24,1);
    INSERT INTO ClassRooms VALUES(18,'Control Sys Lab',24,1);
    INSERT INTO ClassRooms VALUES(19,'Dig & Embd Sys Lab',20,1);
    INSERT INTO ClassRooms VALUES(20,'DSP & Comm Lab',20,1);
    INSERT INTO ClassRooms VALUES(21,'Electromechanical System Lab',28,1);
    INSERT INTO ClassRooms VALUES(22,'Farabi/Web Tech Lab',36,1);
    INSERT INTO ClassRooms VALUES(23,'Gen Purpose Lab',40,1);
    INSERT INTO ClassRooms VALUES(24,'Shirazi/DB Tech Lab',36,1);
    INSERT INTO ClassRooms VALUES(25,'Adv Elect Lab',30,2);
    INSERT INTO ClassRooms VALUES(26,'Classroom 16',42,2);
    INSERT INTO ClassRooms VALUES(27,'Classroom 17',49,2);
    INSERT INTO ClassRooms VALUES(28,'Classroom 18',56,2);
    INSERT INTO ClassRooms VALUES(29,'Classroom 19',42,2);
    INSERT INTO ClassRooms VALUES(30,'Classroom 20',49,2);
    INSERT INTO ClassRooms VALUES(31,'Classroom 21',35,3);
    INSERT INTO ClassRooms VALUES(32,'Classroom 22',35,3);
    INSERT INTO ClassRooms VALUES(33,'MDA Lab',20,3);
    CREATE TABLE DegreeBatches (BatchId NUMBER, BatchName VARCHAR2(50), Strength NUMBER);
    INSERT INTO DegreeBatches VALUES(1,'BIT-11',79);          
    INSERT INTO DegreeBatches VALUES(2,'BIT-12',28);          
    INSERT INTO DegreeBatches VALUES(3,'BS(CS)-1',35);          
    INSERT INTO DegreeBatches VALUES(4,'BS(CS)-2',78);          
    INSERT INTO DegreeBatches VALUES(5,'BE(SE)-1',69);          
    INSERT INTO DegreeBatches VALUES(6,'BE(SE)-2',84);          
    INSERT INTO DegreeBatches VALUES(7,'BE(SE)-3',64);          
    INSERT INTO DegreeBatches VALUES(8,'BICSE-7',84);          
    INSERT INTO DegreeBatches VALUES(9,'BICSE-8',43);          
    INSERT INTO DegreeBatches VALUES(10,'BEE-1',112);          
    INSERT INTO DegreeBatches VALUES(11,'BEE-2',151);     
    INSERT INTO DegreeBatches VALUES(12,'BEE-3',157);     
    INSERT INTO DegreeBatches VALUES(13,'BEE-4',157);     
    Best Regards
    Bilal
    Edited by: Bilal on 27-Dec-2012 09:52
    Edited by: Bilal on 27-Dec-2012 10:07

    Bilal, thanks for the nice problem! Another possibility for duplicate checking is to write a small PL/SQL function returning 1 if a duplicate id is found, then equate it to 0: 'Duplicate_Token_Found (p_str_main VARCHAR2, p_str_trial VARCHAR2) RETURN NUMBER'. This would parse the second string and might use p_str_main LIKE '%,' || l_id || ',%' for each id. Anyway the full query (without that) is given below:
    Solution with names
    SQL> WITH rsf_itm (con_id, max_weight, nxt_id, lev, tot_weight, tot_profit, path, root_id, lev_1_id) AS (
      2  SELECT c.id,
      3         c.max_weight,
      4         i.id,
      5         0,
      6         i.item_weight,
      7         i.item_profit,
      8         ',' || i.id || ',',
      9         i.id,
    10         0
    11    FROM items i
    12   CROSS JOIN containers c
    13   UNION ALL
    14  SELECT r.con_id,
    15         r.max_weight,
    16         i.id,
    17         r.lev + 1,
    18         r.tot_weight + i.item_weight,
    19         r.tot_profit + i.item_profit,
    20         r.path || i.id || ',',
    21         r.root_id,
    22         CASE WHEN r.lev = 0 THEN i.id ELSE r.nxt_id END
    23    FROM rsf_itm r
    24    JOIN items i
    25      ON i.id > r.nxt_id
    26     AND r.tot_weight + i.item_weight <= r.max_weight
    27   ORDER BY 1, 2
    28  ) SEARCH DEPTH FIRST BY nxt_id SET line_no
    29  , rsf_con (nxt_con_id, nxt_line_no, con_path, itm_path, tot_weight, tot_profit, lev) AS (
    30  SELECT con_id,
    31         line_no,
    32         To_Char(con_id),
    33         ':' || con_id || '-' || (lev + 1) || ':' || path,
    34         tot_weight,
    35         tot_profit,
    36         0
    37    FROM rsf_itm
    38   UNION ALL
    39  SELECT r_i.con_id,
    40         r_i.line_no,
    41         r_c.con_path || ',' || r_i.con_id,
    42         r_c.itm_path ||  ':' || r_i.con_id || '-' || (r_i.lev + 1) || ':' || r_i.path,
    43         r_c.tot_weight + r_i.tot_weight,
    44         r_c.tot_profit + r_i.tot_profit,
    45         r_c.lev + 1
    46    FROM rsf_con r_c
    47    JOIN rsf_itm r_i
    48      ON r_i.con_id > r_c.nxt_con_id
    49   WHERE r_c.itm_path NOT LIKE '%,' || r_i.root_id || ',%'
    50     AND r_c.itm_path NOT LIKE '%,' || r_i.lev_1_id || ',%'
    51     AND r_c.itm_path NOT LIKE '%,' || r_i.nxt_id || ',%'
    52  )
    53  , paths_ranked AS (
    54  SELECT itm_path || ':' itm_path, tot_weight, tot_profit, lev + 1 n_cons,
    55         Rank () OVER (ORDER BY tot_profit DESC) rnk,
    56         Row_Number () OVER (ORDER BY tot_profit DESC) sol_id
    57    FROM rsf_con
    58  ), best_paths AS (
    59  SELECT itm_path, tot_weight, tot_profit, n_cons, sol_id
    60    FROM paths_ranked
    61   WHERE rnk = 1
    62  ), row_gen AS (
    63  SELECT LEVEL lev
    64    FROM DUAL
    65  CONNECT BY LEVEL <= (SELECT Count(*) FROM items)
    66  ), con_v AS (
    67  SELECT  b.itm_path, r.lev con_ind, b.sol_id, b.tot_weight, b.tot_profit,
    68          Substr (b.itm_path, Instr (b.itm_path, ':', 1, 2*r.lev - 1) + 1,
    69            Instr (b.itm_path, ':', 1, 2*r.lev) - Instr (b.itm_path, ':', 1, 2*r.lev - 1) - 1)
    70             con_nit_id,
    71          Substr (b.itm_path, Instr (b.itm_path, ':', 1, 2*r.lev) + 1,
    72            Instr (b.itm_path, ':', 1, 2*r.lev + 1) - Instr (b.itm_path, ':', 1, 2*r.lev) - 1)
    73             itm_str
    74    FROM best_paths b
    75    JOIN row_gen r
    76      ON r.lev <= b.n_cons
    77  ), con_split AS (
    78  SELECT itm_path, con_ind, sol_id, tot_weight, tot_profit,
    79         Substr (con_nit_id, 1, Instr (con_nit_id, '-', 1) - 1) con_id,
    80         Substr (con_nit_id, Instr (con_nit_id, '-', 1) + 1) n_items,
    81         itm_str
    82    FROM con_v
    83  ), itm_v AS (
    84  SELECT  c.itm_path, c.con_ind, c.sol_id, c.con_id, c.tot_weight, c.tot_profit,
    85          Substr (c.itm_str, Instr (c.itm_str, ',', 1, r.lev) + 1,
    86            Instr (c.itm_str, ',', 1, r.lev + 1) - Instr (c.itm_str, ',', 1, r.lev) - 1)
    87             itm_id
    88    FROM con_split c
    89    JOIN row_gen r
    90      ON r.lev <= c.n_items
    91  )
    92  SELECT v.sol_id,
    93         v.tot_weight s_wt, v.tot_profit s_pr, c.id c_id, c.name c_name, c.max_weight m_wt,
    94         Sum (i.item_weight) OVER (PARTITION BY v.sol_id, c.id) c_wt,
    95         i.id i_id, i.name i_name, i.item_weight i_wt, i.item_profit i_pr
    96    FROM itm_v v
    97    JOIN containers c
    98      ON c.id = To_Number (v.con_id)
    99    JOIN items i
    100      ON i.id = To_Number (v.itm_id)
    101   ORDER BY sol_id, con_id, itm_id
    102  /
        SOL_ID S_WT S_PR  C_ID C_NAME          M_WT C_WT  I_ID I_NAME     I_WT I_PR
             1  255  255     1 SEECS UG Block   100  100     1 BIT-10       35   35
                                                             2 BIT-11       40   40
                                                             6 BICSE-7      25   25
                             2 IAEC Building     70   70     4 BSCS-3       40   40
                                                             7 BESE-3       30   30
                             3 RIMMS Building    90   85     3 BSCS-2       35   35
                                                             5 BEE-4        50   50
             2  255  255     1 SEECS UG Block   100   95     4 BSCS-3       40   40
                                                             6 BICSE-7      25   25
                                                             7 BESE-3       30   30
                             2 IAEC Building     70   70     1 BIT-10       35   35
                                                             3 BSCS-2       35   35
                             3 RIMMS Building    90   90     2 BIT-11       40   40
                                                             5 BEE-4        50   50
             3  255  255     1 SEECS UG Block   100  100     3 BSCS-2       35   35
                                                             4 BSCS-3       40   40
                                                             6 BICSE-7      25   25
                             2 IAEC Building     70   65     1 BIT-10       35   35
                                                             7 BESE-3       30   30
                             3 RIMMS Building    90   90     2 BIT-11       40   40
                                                             5 BEE-4        50   50
             4  255  255     1 SEECS UG Block   100  100     3 BSCS-2       35   35
                                                             4 BSCS-3       40   40
                                                             6 BICSE-7      25   25
                             2 IAEC Building     70   70     2 BIT-11       40   40
                                                             7 BESE-3       30   30
                             3 RIMMS Building    90   85     1 BIT-10       35   35
                                                             5 BEE-4        50   50
             5  255  255     1 SEECS UG Block   100   95     2 BIT-11       40   40
                                                             6 BICSE-7      25   25
                                                             7 BESE-3       30   30
                             2 IAEC Building     70   70     1 BIT-10       35   35
                                                             3 BSCS-2       35   35
                             3 RIMMS Building    90   90     4 BSCS-3       40   40
                                                             5 BEE-4        50   50
             6  255  255     1 SEECS UG Block   100  100     2 BIT-11       40   40
                                                             3 BSCS-2       35   35
                                                             6 BICSE-7      25   25
                             2 IAEC Building     70   65     1 BIT-10       35   35
                                                             7 BESE-3       30   30
                             3 RIMMS Building    90   90     4 BSCS-3       40   40
                                                             5 BEE-4        50   50
             7  255  255     1 SEECS UG Block   100  100     2 BIT-11       40   40
                                                             3 BSCS-2       35   35
                                                             6 BICSE-7      25   25
                             2 IAEC Building     70   70     4 BSCS-3       40   40
                                                             7 BESE-3       30   30
                             3 RIMMS Building    90   85     1 BIT-10       35   35
                                                             5 BEE-4        50   50
             8  255  255     1 SEECS UG Block   100  100     1 BIT-10       35   35
                                                             4 BSCS-3       40   40
                                                             6 BICSE-7      25   25
                             2 IAEC Building     70   70     2 BIT-11       40   40
                                                             7 BESE-3       30   30
                             3 RIMMS Building    90   85     3 BSCS-2       35   35
                                                             5 BEE-4        50   50
             9  255  255     1 SEECS UG Block   100  100     1 BIT-10       35   35
                                                             4 BSCS-3       40   40
                                                             6 BICSE-7      25   25
                             2 IAEC Building     70   65     3 BSCS-2       35   35
                                                             7 BESE-3       30   30
                             3 RIMMS Building    90   90     2 BIT-11       40   40
                                                             5 BEE-4        50   50
            10  255  255     1 SEECS UG Block   100  100     1 BIT-10       35   35
                                                             3 BSCS-2       35   35
                                                             7 BESE-3       30   30
                             2 IAEC Building     70   65     2 BIT-11       40   40
                                                             6 BICSE-7      25   25
                             3 RIMMS Building    90   90     4 BSCS-3       40   40
                                                             5 BEE-4        50   50
            11  255  255     1 SEECS UG Block   100  100     1 BIT-10       35   35
                                                             3 BSCS-2       35   35
                                                             7 BESE-3       30   30
                             2 IAEC Building     70   65     4 BSCS-3       40   40
                                                             6 BICSE-7      25   25
                             3 RIMMS Building    90   90     2 BIT-11       40   40
                                                             5 BEE-4        50   50
            12  255  255     1 SEECS UG Block   100   95     1 BIT-10       35   35
                                                             3 BSCS-2       35   35
                                                             6 BICSE-7      25   25
                             2 IAEC Building     70   70     2 BIT-11       40   40
                                                             7 BESE-3       30   30
                             3 RIMMS Building    90   90     4 BSCS-3       40   40
                                                             5 BEE-4        50   50
            13  255  255     1 SEECS UG Block   100   95     1 BIT-10       35   35
                                                             3 BSCS-2       35   35
                                                             6 BICSE-7      25   25
                             2 IAEC Building     70   70     4 BSCS-3       40   40
                                                             7 BESE-3       30   30
                             3 RIMMS Building    90   90     2 BIT-11       40   40
                                                             5 BEE-4        50   50
            14  255  255     1 SEECS UG Block   100  100     1 BIT-10       35   35
                                                             2 BIT-11       40   40
                                                             6 BICSE-7      25   25
                             2 IAEC Building     70   65     3 BSCS-2       35   35
                                                             7 BESE-3       30   30
                             3 RIMMS Building    90   90     4 BSCS-3       40   40
                                                             5 BEE-4        50   50
    98 rows selected.
    Elapsed: 00:00:01.42Edited by: BrendanP on 20-Jan-2013 11:25
    I found the regex needed to deduplicate:
    AND RegExp_Instr (r_c.itm_path || r_i.path, ',(\d+),.*?,\1,') = 0

  • Filter REGEX in SDO_RDF_MATCH

    Hello;
    I want to know how to use the regex, like or similar under the SDO_RDF_MATCH. I only see examples with simple conditions 'h < 5' etc..
    Regards
    Isidro

    Hello;
    I think it so, but the question is about the last parameter 'filter condition' of SDO_RDF_MATCH.
    1.- If you work with namespaces, you cannot tell directly about elements in them,.. well, without using regular expressions.
    In your example;
    SELECT x Male
    FROM TABLE(SDO_RDF_MATCH( '(?x rdf:type :Male)',
    SDO_RDF_Models('family'),
    null, SDO_RDF_Aliases(SDO_RDF_Alias('','http://www.example.org/family/')), null)) WHERE x LIKE '%T%';
    if this alias the preffix, 'family'
    <b>SDO_RDF_Alias('family','http://www.example.org/family/'</b>
    in this <b>WHERE</b> you cannot express the clause <b>LIKE 'family:Jo' </b> because out of this query the result is
    http://www.example.org/family/John
    2.- The FILTER parameter is in most cases however it is more efficient to include it as part of SDO_RDF_MATCH SDO_RDF_MATCH what arguments can be filtered?
    3.- Then, I tell again the question, Can I use the clause LIKE of similar into SDO_RDF_MATCH to filter string based results.
    Best
    Isidro

  • How to set Query value in WAD w. parameters

    Hi
    Is it possible to set the queryname in the dataprovider using javascript.
    My scenario is that I want to fetch the queryname from the URL with the following javascript
    I have the script:
    function GetPara( name )
         name = name.replace(/[\[]/,"
    \[").replace(/[\]]/,"
         var regexS = "[
    ?&]"name"=([^&#]*)"; 
         var regex = new RegExp( regexS ); 
         var results = regex.exec( window.location.href ); 
         if( results == null )   
              return ""; 
         else   
              return results[1];
    And then I want to implement something like the following in the template
    //First dataprovider (TAB_A_DP) initialization
    <bi:QUERY_VIEW_DATA_PROVIDER name="TAB_A_DP" >
                    <bi:INITIAL_STATE type="CHOICE" value="QUERY" >
                        <bi:QUERY value="SCRIPT_FUNCTION">
                               <bi:SCRIPT_FUNCTION value="GetPara('TAB1')" />
                        </bi:QUERY>
                    </bi:INITIAL_STATE>
                </bi:QUERY_VIEW_DATA_PROVIDER>
    //SEcond dataprovider (TAB_B_DP) initialization
    <bi:QUERY_VIEW_DATA_PROVIDER name="TAB_B_DP" >
                    <bi:INITIAL_STATE type="CHOICE" value="QUERY" >
                        <bi:QUERY value="SCRIPT_FUNCTION">
                               <bi:SCRIPT_FUNCTION value="GetPara('TAB2')" />
                        </bi:QUERY>
                    </bi:INITIAL_STATE>
                </bi:QUERY_VIEW_DATA_PROVIDER>

    Hi Leo
    Sorry I haven't explained my goal very well.
    I want to create a dynamic webtemplate w. two tabs. One tab showing data from one dataprovider and the other tab showing data from another dataprovider.
    My problem is that it's easy enough to set the dataprovider to a specific query but as I have several reports which should use this template then instead of coping the template and change the query name I want a generic way to set the queryname  (e.g. in the url) so I only have one template and not a template per report pair.
    In short I want to set the Initial State dynamic.
                                <bi:QUERY_VIEW_DATA_PROVIDER name="TAB_A_DP" >
                                    <bi:INITIAL_STATE type="CHOICE" value="QUERY" >
                                        <bi:QUERY value="dynamic" text="dynamic" />
                                    </bi:INITIAL_STATE>
                                </bi:QUERY_VIEW_DATA_PROVIDER>
    When I only have one dp I can leave it empty and set the query by typing ?query=<queryname> but what if I have several dataproviders with different queries?
    /John
    Edited by: John Dolph on Aug 26, 2009 3:22 PM

  • Regex to split a URL, not matching

    I'm trying to port Steve Levithan's [parseUri JavaScript function|http://blog.stevenlevithan.com/archives/parseuri] to Java, but I'm having problems getting the regular expression to match anything, even basic URLs. I can confirm that the regular expression +^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)+ matches http://www.google.com/, but I can't get it to work in Java. The code I'm using is:
    String spec = "http://www.google.com/";
    HashMap tempUri = new HashMap();
    String[] parts = {"source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"};
    Pattern pattern = Pattern.compile("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*):?([^:@]*))?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)");
    Matcher matcher = pattern.matcher(spec);
    String match;
    int i=0;
    while(matcher.find()) {
        try {
            match = matcher.group(i);
            tempUri.put(parts, match);
    } catch(Exception ex) {
    tempUri.put(parts[i],"");
    i++;
    The problem is, the matcher only ever finds one match (the whole string), it should be splitting it. I'm sure I'm escaping the characters properly.
    Edited by: Echilon on Nov 3, 2008 5:08 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    As usual, after trying for hours in vain, I stumble upon the answer just after posting. :P
    Rather than while(matcher.find()), I used if(matcher.find()), then looped through the groups.
    For anyone interested, [http://leghumped.com/blog/2008/11/03/java-matching-urls-with-regex-wildcards/|http://leghumped.com/blog/2008/11/03/java-matching-urls-with-regex-wildcards/] might help :)
    Edited by: Echilon on Nov 3, 2008 11:08 AM

  • Multiple like statements in a query

    Hi,
    I wonder if it's possible to have multiple like statements in a query.
    suppose instead of
    select * from someTable where remarks like '%ab%'
    I want to search for many string patterns such as '%edi%' '%odi%' '%di%' '%gf%' '%od%' '%podi%' etc. in one query.
    BTW, the table contains many millions of records.
    Regards
    Crusoe
    Edited by: Crusoe on 19-Jan-2009 00:25

    Crusoe wrote:
    This regexp_like function does not work with the development server to which I have rights to create tables etc. I guess it only works in 10g or greater. However i tried a quick test in the production server and it worked. It returned rows where the values between the | characters were found anywhere in the field ( I must learn this regex syntax sometime). Yes, regular expressions are 10g upwards. (You really should have your development server reflect your production server)
    There was a thread a while back giving an introduction to regular expressions...
    Introduction to regular expressions ...

  • New java-like scripting language w/ powerful regex

    Hi,
    Just wanted to let you know that there's now a new scripting language called P~ with the following important aspects:
    1) matches and exceeds Perl regex solveability -- e.g. offers full regex-based boolean query on non-indexed corpus, offers completely general side-effects, more accurate than Perl code assertions
    2) basic grammar is very Java like
    3) regex grammar is algebraic, not metacharacter-based, leads to more readable and maintainable solutions to hard problems
    4) offers an easy tool to debug matching behavior of your regexes (rules)
    5) though a full featured scripting language, you can write scriptlets and call them from Java classes, with arguments. Allows you to use your regex solutions in Java applications.
    6) the language is offered as a Java library, as well as a standalone application that runs the library. This means that your scripts can import java classes available in the classpath, you can leverage existing Java libraries.
    Check out the website and try it out: http://ptilde.pbwiki.com
    Andy

    True to an extent. We don't yet have lookaround assertions and won't have backreferencing any time soon. But there are same-time assertions which offer much of the same, and allow for boolean query.
    More accurate general statement insertion side-effects (than Perl code assertions) means that your statements are executed if and only they wrap a subpattern that is part of the ultimate best match -- Perl code assertions execute when the automata encounters them, even if where they are in the regex is ultimately not part of the match, or even if there is no match at all. This aspect is a huge part of the solveability advantage.
    As to the regex test cases, there are about 1000, and we will post them soon.

  • How pervasive is this regex bug?  Is there an official bug ID?

    Oracle has a bug in their regular expression handling in 10g 2 and 11g 2. Is this bug also in XE? If so, does it have a bug number I can reference? I don't have support, I'm just evaluating Oracle Database offerings for our company.
    The bug: With 10g 2 Oracle released support for non-greedy quantifiers in regular expressions. See http://docs.oracle.com/cd/E11882_01/appdev.112/e25518/adfns_regexp.htm#autoId6
    However, it has bugs.
    SQL*Plus: Release 10.2.0.5.0 - Production on Tue May 28 22:20:07 2013
    Copyright (c) 1982, 2010, Oracle.  All Rights Reserved.
    SQL> select regexp_substr('foo, bar, qux,','.*b.*?,') from dual;
    REGEXP_SUBSTR(
    foo, bar, qux,
    SQL> select regexp_substr('foo, bar, qux,','.*?b.*,') from dual;
    REGEXP_SU
    foo, bar,and same results on SQL*Plus: Release 11.2.0.1.0 Production. This is obviously a bug. One can argue about the differing possible interpretations of the sequence `.\*?`, but there is nothing that suggest `b.\*,` shouldn't pick up `qux`. I have a dozen other examples if you want. So my question is that since this has been a bug in released production code for over a year, is there a bug/defect number I can use to track it's eventual resolution? I don't have a support contract to ask support directly because I'm just evaluating right now. I'm trying to push for Oracle but bugs like this make it hard for me to use the argument that Oracle is relatively bug free.
    Fixed * interpreted as markup

    Oracle has a bug in their regular expression handling in 10g 2 and 11g 2. Is this bug also in XE?If a bug exists in Oracle Database 11.2.0.2, it's very likely to exist in 11.2 XE as well, as 11.2 XE is based on that version.
    and same results on SQL*Plus: Release 11.2.0.1.0 ProductionThis is no matter of SQL*Plus, as this is only the client, while the query you execute is processed by the database you're connected to.
    Despite that, I wonder how it comes you have SQL*Plus 11.2.0.1.0 on your machine, because XE ships with 11.2.0.2. But this has no impact on your issue...
    but there is nothing that suggest `b.*,` shouldn't pick up `qux`. I'm not sure about that. It's a question of where your "preceding" definition ends and how you interprete the documentation. See the differences (or no difference) when using subgroups to separate greedy and nongreedy operators explicitly, e. g.
    select regexp_substr('foo, bar, qux, ','.*?(b.*,)') from dual;
    -- or even
    select regexp_substr('foo, bar, qux, ','(.*?b)(.*,)') from dual; return foo, bar,, which would fit the "first string to match" strategy documented for regexp_substr.
    On the other hand, you could enforce the behaviour you seem to expect with making the greedy subgroup explicit.
    select regexp_substr('foo, bar, qux, ','.*?b(.*,)') from dual;
    -- or
    select regexp_substr('foo, bar, qux, ','(.*b)(.*?,)') from dual; will return your complete string.
    Of course, you can always argue on whether you should "reuse" characters for different groups when evaluating the regex. From my personal experience, using explicit subgroups helps structuring (and understanding) your regex and makes moving through different implementations easier...
    I'm trying to push for Oracle but bugs like this make it hard for me to use the argument that Oracle is relatively bug free.This is mostly a point of view, as your "relatively" indicates...
    -Udo

  • Wildcards or regex in CSS dns-record

    Hi, is it possible to use regex or wildcards in dns-record command in CSS?. I would like to use something like
    dns-record a *.example.com 10.10.10.10
    in order to CSS responds to test1.example.com and test2.example.com without introduce this last two dns-records in CSS.
    Thank you in advance.
    Samuel

    This can also happen if you do KAL-ICMP keepalive to your VIP
    CSCtj38660 Bug Details
    dns-record kal-icmp keepalive to vip could incorrectly go DOWN
    Symptom:The CSS is configured with a dns-record of type kal-icmp, querying a local VIP could incorrectly go DOWN when the service associated with that VIP is Alive.
    Conditions:The CSS is configured with a dns-record of type kal-icmp, querying a local VIP. The keepalive could incorrectly go DOWN if the service reports of a load of 254.
    Workaround:Configure "no load reporting" on the CSS

  • Regex Pattern Match in an extremely long string

    I need to search a file containing 1 extremely long line (approximately 1 million characters), The pattern I want to search is "ABC" as long as it appears at least n times whatever user input as n. I need the position of where this pattern is found. How to best do this? I tried to break the input into blocks of 100000 characters at a time as too many characters read cause the 'java out of memory' error to occur.
    Then I converted this to a string in order to use REGEX to search. My problem is how to ensure that the last few characters of the current block is also being searched too? How to write the regex expression to do this? Will breaking the input file into multiple lines help?
    eg:
    Searching for ABC as long as it appears at least 3 times continuously ie (ABCABCABC)
    Original Line = XXXXXXXABCABCABCXXXXXXABCX
    The first block of 10 characters read is XXXXXXXABCABC
    The second block of 10 characters read is ABCXXXXXXABCX
    The search result should be position 7 and position 22

    If the sequence of characters is longer than a few hundred KB, then turning it into a String requires you to have enough heap space available in the JVM to store the entire String.
    If that is a problem, an alternative solution is to have a while loop over an InputStream that reads from the source of characters (a file, a network connection, stdin etc.) and looks for the string. Keep a ring buffer the size of the query string, and read the data from the InputStream into it. Then for each character read, compare the content of the ring buffer to the query string.
    This way you will not use more heap space than the size of the query-string, and the size of whatever buffer you use in your InputStream (8KB for the empty constructor of BufferedInputStream at the moment) plus the odds'n ends from the implementation.

Maybe you are looking for

  • I have home sharing on but sharing is not an option on either computer

    I have my itunes library on a Vista PC and have a Wireless Cicso router and am trying to share the library on my Windows 7 PC.  I have home sharing turned on on both PC's.  I have authorized both computers.  The sharing option does not show up in itu

  • First BT keyboard, now BT mouse, won't connect

    Yesterday my Apple BT keyboard wouldn't connect. Flashing green light on kb. Changed batteries, no difference. Deleted pairing. When creating new pairing, it sees the keyboard but can't receive the pairing code. I read the forum here, figured I wasn'

  • Document not visible in Original document list

    Hi I want to add document to SAP DMS, found BAPI_DOCUMENT_CREATE2 on net. I found a sample program on a thread but when I am executing this I get the newly created document in CV03N but I dont find the document in Original document list. FUNCTION Z_D

  • Javascript alert stops button firing in IE

    This isn't really an Apex issue, it seems to be the way IE works - but I wonder if anyone has a work-around? 1) I have an item with an onchange event that displays an alert - e.g. onchange="alert('Hello');" 2) I have a button SUBMIT that submits the

  • How do I install Adobe Flash Professional on my E: Drive?

    I am trying to test out Adobe Flash Professional but I have no room in my C: Drive and I need to install it on my E: Drive, but I don't know how to change the file location.