Pattern matching SQL

Hello
I have a data set that is similar to the following
00-1111-2222
01-2000
ABCDEFG
A bcde
04-3456
08-2001
I want to retrieve only those records that match the following pattern: ##-YYYY where ## is a number and YYYY is a year
So in this case I only want to retrieve 01-2000 and 08-2001. I tried using regexp_like but was unsuccessful (error invalid operator)
Is there a simple way to do this without using functions or PLSQL, just in SQL? It does not have to be with regexp_like, just any SQL tool.
Thanks in advance, any help is appreciated

Hi,
dbarcell wrote:
It would be safe to use any year greater than 1995
I would not want to return 04-3456 in this query3456 is a year greater than 1995. Why don't you want it?
The following selects rows where str fits the pattern, and the year is betwwen 1995 and 2100. You can easily change it to any other 4-digit years:
WHERE     REGEXP_LIKE ( str
              , '^\d{2}-\d{4}$'
AND     SUBSTR (str, 4, 4)     BETWEEN     '1995'
                                AND     '2100'  
I hope this answers your question.
If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only), and also post the results you want from that data.
Explain, using specific examples, how you get those results from that data.
Always say which version of Oracle you're using.
Edited by: Frank Kulash on Aug 9, 2011 5:58 PM
Here's another way; slightly faster, and works in versions earlier than Oracle 10:
WHERE     TRANSLATE ( str
            , '012345678'
            , '999999999'
            )          = '99-9999'
AND     SUBSTR (str, 4, 4)     BETWEEN     '1995'
                                AND     '2100' If the first two digits have to be between '01' and '12', then add
AND     SUBSTR (str, 1, 2)     BETWEEN     '01'
                                AND     '12'to either version.

Similar Messages

  • SQL pattern matching

    Hi experts,
    I have a requirement for which I need to write a SQL. On our orders search screen there are 2 prompts.
    1) Dealer name (Table.column - DLR_NAM)
    2) State name (Table.column - STATE_NAM)
    When user wants to find the orders placed by all dealers whose name starts with 'A' and state name with 'B', then our query is something like this
    SELECT ORDER_ID, ORDER_ITEM, ORDER_QTY, ORDER_VALU
    FROM ORDERS
    WHERE DLR_NAM LIKE 'A%'
    AND STATE_NAM LIKE 'B%'; -- A and B entered by user in the respective prompt text box
    But there are countries like Greece for which states doesn't exists. In that case STATE_NAME is NULL and the above query becomes something like the below and doesn't return right results
    SELECT ORDER_ID, ORDER_ITEM, ORDER_QTY, ORDER_VALU
    FROM ORDERS
    WHERE DLR_NAM LIKE 'A%'
    AND STATE_NAM LIKE '%'; -- Pattern matching goes wrong due to this AND clause.
    Please suggest how to fix this. It appears simple and my brain is not working after non-stop working for several days.

    You are saying that the user types something in both variables.
    And then this query:
    SELECT ORDER_ID, ORDER_ITEM, ORDER_QTY, ORDER_VALU
    FROM ORDERS
    WHERE DLR_NAM LIKE :bind_dealer || '%'
    AND ( (:bind_state IS NULL) OR (:bind_state IS NOT NULL AND STATE_NAM LIKE :bind_state || '%') );returns rows with STATE_NAM null.
    That does not make sense. If the users types in both variables, then the bindvariable :bind_state is not null, and then STATE_NAM has to begin with the value of :bind_state.
    The only thing I can think of is if you are binding wrong? What is your application coded in? C#? Java? ASP? .NET? How do you prepare your SQL query from your user inputs?
    You will have to post a test case. Create table, insert some test data, run the sql and show it returns the wrong result. I cannot think of any problem without knowing more details :-)

  • Pattern matching in sql scripts

    Hi All,
    I am trying to run some queries for database maintainence and to find out the number of rows inserted in a table on a day. These queries would be stored in a .sql file and a scheduler will trigger these files are regular intervals.
    Amongst these queries , one query that we generally exceute in sql command line is:
    select component, count(*) from test where timestamp like '%2010-11-30%' group by component order by count(*) desc;
    This query gives me a list of components and the number of rows they inserted in 'test' table on a particular day. To fetch the data inserted on a particular day we manually give current date inside pattern matching string -> e.g where timestamp like '%2010-11-30%'
    How can I use pattern matching (as in the above query) in my sql script. How can I fetch the current date and use it in the above sql for pattern matching.
    Please help.

    Assuming your timestamp column has a proper data type like DATE or TIMESTAMP then you should compare dates with dates or timestamps with timestamps. Not timesatamp with a string.
    example
    select component, count(*) cnt
    from test
    where timestamp>= trunc(sysdate)
    and timestamp < trunc(sysdate) /* this line is only needed if you have timestamps in the future */
    group by component
    order by cnt desc;If your column is of the datatype timestamp then use SYSTIMESTAMP instead of SYSDATE.

  • Pattern matching using Regular expression

    Hi,
    I am working on pattern matching using regular expression. I the table, I have 2 columns A and B
    A has value 'A499BPAU4A32A386KBCZ4C13C41D20E'
    B has value like '*CZ4*M11*7NQ+RDR+RSM-R9A-R9B'
    the requirement is that I have to match the columns of B in A. If there is a value with * sign, this must be present in A like 'CZ4' should exit in string A.
    The issue I am facing is that there are 2 values with * sign. The code works fine for first match (CZ4) but it does not look further as M11 does not exist in A.
    I used the condition
    AND instr(A,substr(REGEXP_SUBSTR(B, '*[^*]{3}'),2) ,1)=0
    First of all, is this possible to match multiple patterns in one condition?
    If yes, please suggest.
    Thanks

    user2544469 wrote:
    Thanks a lot Frank. This query worked wonderful for the test data I have provided however I have some concerns:
    - query doesnot include the column BOOK which is a mandatory check.Sorry, that was my mistake. It was a very easy mistake to make, since you posted sample data where it didn't matter. Instead of doing a cross-join between vn and got_must_have_cnt, do an inner join, using book. That means book will have to be in got_must_have_cnt, and all the sub-queries from which it descends. Look for comments that say "March 22".
    If you want to treat '+' in test_cat.codes as '*', then the simplest thing is probably just to use REPLACE, so that when the table has '+', you use '*' instead.
    WITH     got_token_cnt     AS
         SELECT     cat
         ,     book                                        -- Added March 22
         ,     REPLACE (codes, '+', '*') AS codes                    -- If desired.  Changed March 22
         ,     LENGTH (codes) - LENGTH ( TRANSLATE ( codes
                                                       , 'x*+-'
                                      , 'x'
                             ) AS token_cnt
         FROM    test_cat
    ,     cntr     AS
         SELECT     LEVEL     AS n
         FROM     (  SELECT  MAX (token_cnt)     AS max_token_cnt
                 FROM        got_token_cnt
         CONNECT BY     LEVEL     <= max_token_cnt
    ,     got_tokens     AS
         SELECT     t.cat
         ,     t.book                                        -- Added March 22
         ,     REGEXP_SUBSTR ( t.codes
                         , '[*+-]'
                         , 1
                         , c.n
                         )          AS token_type
         ,     SUBSTR ( REGEXP_SUBSTR ( t.codes
                                       , '[*+-][^*+-]*'
                               , 1
                               , c.n
                   , 2
                   )          AS token
         FROM     got_token_cnt     t
         JOIN     cntr          c  ON     c.n     <= t.token_cnt
    ,     got_must_have_cnt     AS
         SELECT       cat, book                                   -- Changed March 22
         ,       COUNT (CASE WHEN token_type = '*' THEN 1 END) AS must_have_cnt
         FROM       got_tokens
         GROUP BY  cat, book                                   -- Changed March 22
    SELECT       mh.cat
    ,       vn.vn_no
    FROM       got_must_have_cnt     mh
    JOIN                    vn  ON  mh.book     = vn.book               -- Changed March 22
    LEFT OUTER JOIN      got_tokens     gt  ON     mh.cat                  = gt.cat
                                     AND INSTR (vn.codes, gt.token) > 1
    GROUP BY  mh.cat
    ,            mh.must_have_cnt
    ,            vn.vn_no
    HAVING       COUNT (CASE WHEN gt.token_type = '*' THEN 1 END)     = mh.must_have_cnt
    AND       COUNT (CASE WHEN gt.token_type = '-' THEN 1 END)     = 0
    ORDER BY  mh.cat
    - query is very slow with 60000 records in vn table. Cost is somewhere around 36000.See these threads:
    When your query takes too long ...
    HOW TO: Post a SQL statement tuning request - template posting
    Relational databases were designed to have (at most) one piece of information in each column. If you decide to have multiple items in the same column (as you have a variable number of tokens in the codes column), don't be surprised if that makes things slower and more complicated. Most of the query I posted, and perhaps most of the time needed, is jsut to normalize the data. If you stored the data in a narmalized form, perhaps something like got_tokens, then you wouldn't need the first 3 sub-queries that I posted.
    Edited by: Frank Kulash on Mar 22, 2011 12:04 PM

  • The featest pattern match

    Now I met a difficult question.Firstly,we have a criterion table as below:Combination Name     Service     UnitLength     UnitHeight     LoadStatus     Bill No ......(until unbounded fields). Some data like this
    Combination Name |     Service |     UnitLength | UnitHeight | LoadStatus |     Bill No ......
    COM1 | CSC | 40 | 96 |
    COM2 | CSC | 40 | 96 | F |
    COM3 | CSC | 40 | 96 | F | SEA-SCS
    If there is an object has the attribute UnitLength equal 40 and UnitHeight equal 96 the correct combination COM1 is selected;otherwise, if
    it has the attribute UnitLength equal 40  and UnitHeight equal 96 and LoadStatus equal F then the appropriate combination COM2 is selected; then if the object has UnitLength equal 40  and UnitHeight equal 96 and LoadStatus equal F  and many other conditions ,the featest  pattern match will be the completely match combination.But when there is no completely match combination,we may get a combination  closer match the object.For example,an object has the following attributes UnitLength equal 40 and UnitHeight equal 96 and LoadStatus equal F Bill No equal SEA-SCS* ,the best result will be COM3.
    How can we find a pl/sql procedure resolve this question?
    Thanks very much! Look forward to your answer!
    About the combination structure(Combinaton.xsd) as below:
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb" version="1.0" xdb:storeVarrayAsTable="true">
         <xs:element name="()" type="CombinationType" xdb:defaultTable="COMBINATION"/>
         <xs:complexType name="CombinationType" xdb:SQLType="Combination_T">
              <xs:sequence>
                   <xs:element name="FilterNam" type="FilterNamType" xdb:SQLName="FilterNam"/>
                   <xs:element name="Priority" type="PriorityType" xdb:SQLName="Priority"/>
                   <xs:element name="FilterType" type="FilterType" minOccurs="0" xdb:SQLName="TYPE"/>
                   <xs:element name="Service" type="ServiceType" xdb:SQLName="Service"/>
                   <xs:element name="Operator" type="OperatorType" xdb:SQLName="Operator"/>
                   <xs:element name="OperTim" type="OperTimType" xdb:SQLName="OperTim"/>
                   <xs:element name="FilterItems" type="FilterItemsType" xdb:SQLName="FilterItems"/>
                   <xs:element name="PlanMatrix" type="PlanMatrixType" xdb:SQLName="PlanMatrix"/>
                   <xs:element name="Discription" type="DiscriptionType" xdb:SQLName="Discription"/>
              </xs:sequence>
         </xs:complexType>
         <xs:complexType name="FilterItemsType" xdb:SQLType="FilterItems_T">
              <xs:sequence>
                   <xs:element name="FilterItem" type="FilterItemType" maxOccurs="unbounded" xdb:SQLName="FilterItem" xdb:SQLCollType="FilterItem_V"/>
              </xs:sequence>
         </xs:complexType>
         <xs:complexType name="FilterItemType" xdb:SQLType="FilterItem_T">
              <xs:sequence>
                   <xs:element name="Charateristic" type="CharateristicType" xdb:SQLName="Charateristic"/>
                   <xs:element name="Oper" type="OperType" xdb:SQLName="Oper"/>
                   <xs:element name="Value" type="ValueType" xdb:SQLName="Value"/>
              </xs:sequence>
         </xs:complexType>
         <xs:complexType name="PlanMatrixType" xdb:SQLType="PlanMatrix_T">
              <xs:sequence>
                   <xs:element name="PlanMatrixElement" type="PlanMatrixElementType" maxOccurs="3" xdb:SQLName="PlanMatrixElement" xdb:SQLCollType="PlanMatrixElement_V"/>
              </xs:sequence>
         </xs:complexType>
         <xs:complexType name="PlanMatrixElementType" xdb:SQLType="PlanMatrixElementTypem_T">
              <xs:sequence>
                   <xs:element name="Interval" type="IntervalType" xdb:SQLName="Interval"/>
                   <xs:element name="DaysBfETD" type="DaysBfETDType" xdb:SQLName="DaysBfETD"/>
                   <xs:element name="Resevevation" type="ResevevationType" xdb:SQLName="Resevevation"/>
                   <xs:element name="Algorithm" type="AlgorithmType" xdb:SQLName="Algorithm"/>
                   <xs:element name="HDP" type="HDPType" xdb:SQLName="HDP"/>
              </xs:sequence>
         </xs:complexType>
         <xs:simpleType name="FilterNamType">
              <xs:restriction base="xs:string">
                   <xs:minLength value="1"/>
                   <xs:maxLength value="30"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="OperatorType">
              <xs:restriction base="xs:string">
                   <xs:minLength value="1"/>
                   <xs:maxLength value="10"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="ServiceType">
              <xs:restriction base="xs:string">
                   <xs:minLength value="1"/>
                   <xs:maxLength value="20"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="FilterType">
              <xs:restriction base="xs:string">
                   <xs:minLength value="1"/>
                   <xs:maxLength value="4"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="PriorityType">
              <xs:restriction base="xs:integer"/>
         </xs:simpleType>
         <xs:simpleType name="OperTimType">
              <xs:restriction base="xs:date"/>
         </xs:simpleType>
         <xs:simpleType name="CharateristicType">
              <xs:restriction base="xs:string">
                   <xs:minLength value="1"/>
                   <xs:maxLength value="35"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="OperType">
              <xs:restriction base="xs:string">
                   <xs:minLength value="1"/>
                   <xs:maxLength value="10"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="ValueType">
              <xs:restriction base="xs:string">
                   <xs:minLength value="1"/>
                   <xs:maxLength value="35"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="DiscriptionType">
              <xs:restriction base="xs:string">
                   <xs:minLength value="1"/>
                   <xs:maxLength value="35"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="IntervalType">
              <xs:restriction base="xs:integer"/>
         </xs:simpleType>
         <xs:simpleType name="DaysBfETDType">
              <xs:restriction base="xs:integer"/>
         </xs:simpleType>
         <xs:simpleType name="ResevevationType">
              <xs:restriction base="xs:string">
                   <xs:minLength value="1"/>
                   <xs:maxLength value="35"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="AlgorithmType">
              <xs:restriction base="xs:string">
                   <xs:minLength value="1"/>
                   <xs:maxLength value="35"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="HDPType">
              <xs:restriction base="xs:string">
                   <xs:minLength value="0"/>
                   <xs:maxLength value="35"/>
              </xs:restriction>
         </xs:simpleType>
    </xs:schema>
    And the data(Combination.xml) like that:
    <Combination
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="http://localhost/xml_test//Combination.xsd">
    <FilterNam>40/8.6/F/BILL</FilterNam>
    <Priority>5</Priority>
    <Service>KR-SHIPPING-LINE</Service>
    <Operator>ZHANGRUI</Operator>
    <OperTim>2010-06-09</OperTim>
    <FilterItems>
    <FilterItem>
    <Charateristic>UnitLegth</Charateristic>
    <Oper>=</Oper>
    <Value>40</Value>
    </FilterItem>
    <FilterItem>
    <Charateristic>UnitHeigh</Charateristic>
    <Oper>=</Oper>
    <Value>8.6</Value>
    </FilterItem>
    <FilterItem>
    <Charateristic>LoadStatus</Charateristic>
    <Oper>=</Oper>
    <Value>F</Value>
    </FilterItem>
    <FilterItem>
    <Charateristic>BillNo</Charateristic>
    <Oper>=</Oper>
    <Value>SEA-BILLING-NO.1</Value>
    </FilterItem>
    </FilterItems>
    <PlanMatrix>
    <PlanMatrixElement>
    <Interval>1</Interval>
    <DaysBfETD>3</DaysBfETD>
    <Resevevation>1 BAY</Resevevation>
    <Algorithm>MIX VESSEL</Algorithm>
    </PlanMatrixElement>
    </PlanMatrix>
    </Combination>
    Edited by: user10904897 on 2010-6-9 下午8:23
    Edited by: user10904897 on 2010-6-9 下午8:57

    my best would be to do something like the following since i don't have oracle and can't simulate it right now:
    select a.*,
           case when unitlength = 40 and unitheight = 96 and loadstatus ='F' and billno = 'SEA-SCS' then 'COM3'
                  when unitlength = 40 and unitheight = 96 and loadstatus ='F' and billno != 'SEA-SCS' then 'COM2'
                  when unitlength = 40 and unitheight = 96 and loadstatus != 'F' then 'COM1'
                  else 'print what ever you want'
           end
    from <table_name>
    where <any_conditions_you_want_if_any>
    ;

  • How do I set multiple pattern matching Vi's and make overlappin​g pattern matches to count as one?

    Hello! I'm a student and I'm currently making a project using pattern matching.
    My patterns are from chick foot/feet.
    I'm  created multiple pattern matching VI's to detect all the feet because I find it difficult/impossible to match all the feet with a single pattern/template.
    However, when using multiple pattern matching VI's some pattern matches detect the same foot, hence overlapping.
    So how can I make the overlaping pattern matches to be counted as one?
    Thank you in advance

    Thank you for replying Sir Zwired1.
    I'm still a newbie in using LabVIEW so pardon me if I can't understand fully
    The objective of my project is to detect all the feet through pattern matching and count the pattern matches made.
    "Keep a 2D array of counts, initialized to zero and the same size as your array of possible locations, and increment the value every time you get a match. If multiple pattern matching attempts result in a match a given location in your count array might be "3" but all you care about is if the number is greater than zero."
    I'm sorry, but how do you do this? BTW, I'm using vision assistant.

  • Trouble using a pattern match in the GO URL when the value starts with %

    Hi guys,
    We are trying to use a Go URL as follows:
    [http://hostname.com:9704/analytics/saw.dll?Go&Path=/users/administrator/Test/TestReport&Action=Navigate&col1=TestReport.SUBJECT&op1=like&val1="%25D8D8%25"|http://hostname.com:9704/analytics/saw.dll?Go&Path=/users/administrator/Test/TestReport&Action=Navigate&col1=TestReport.SUBJECT&op1=like&val1="%25D8D8%25"]
    Basically, we want to send the filter : SUBJECT like '%D8D8%' in the GoURL. However, the report that opens up does not fetch any rows because BI somehow messes up the clause by not recognizing the leading %25 (which is an escaped % character). Instead it resolves the %25D8D8%25 into something like �D8% .
    As you can see, the %25 at the end however gets resolved correctly but somehow the one at the beginning gets clubbed with the leading D8 to give �.
    Any idea, how to get BI to accept a leading escaped % character when doing a pattern match in the Go URL?

    I'm heading to the Apple Store in Danbury CT tomorrow to test out a MacBook Pro. I'll happily post what I like and dislike here.
    Waiting for a MacBook Pro...   Other OS  

  • How can I read a template and differentiate if it is a pattern matching template or a geometric matching template?

    Hey all,
    I would like to know how can I read a template´s information to know if it is a pattern macthing or a geometric matching template? 
    In my code, users provide templates and the algorithm must match them using pattern matching or geometric matching depending on the template.
    At the moment I am doing it by including a P or a G in the name of the file, but I would like to avoid this and read the information from the file.
    Any ideas?
    Thanks in advance,
    Esteban
    Solved!
    Go to Solution.

    Hey Esteban,
    you can use the VI "IMAQ Is Vision Info Present 2 VI" to reice the information:
    IMAQ Is Vision Info Present 2 VI - NI Vision 2011 for LabVIEW Help - National Instruments
    http://zone.ni.com/reference/en-XX/help/370281P-01/imaqvision/imaq_is_vision_info_present_2/
    Take a look at the attached VI
    Stephan
    Attachments:
    Determine Pattern type.zip ‏13 KB

  • OBIEE 11G : Remove label (is like pattern match) in the prompt

    Hi Experts,
    I have Gone through this thread Re: OBIEE 11G : Remove label (is like pattern match) in the prompt and applied JS as mentioed but
    It works for the first display of the page but its back as soon as you hit the apply button
    can be it be removed permanently? Thanks in Advance

    Hi Nagen,
    You can try the following:
    Create a variable prompt with the column vales that you want to match
    Create a filter in the analysis criteria tab on the column, set to pick up the variable, and define the IS LIKE here.
    It is effectively doing the same task as the standard prompt approach does, but in a round-a-bout way which doesn't include adding any of Oracle's text in.

  • Is there a way to turn the pattern matching example in Labview to instead of loading a rectangle around what you want the template to be you can use an image display , I've be trying and can get no where with it

    What I want to do is , have two images on image displays and the pass them through the same setup as the pattern matching example to get the number of matches , I have attached what I have done and also given the pattern matching example program as well.
    Hope to get answers back soon,
                                     Thanks Alan
    Attachments:
    screenshot.docx ‏48 KB
    Pattern Matching Example.vi ‏100 KB

    Hi there!
    The example used can be adapted for comparing two images, however the algorithm and coding for finding the differences is more specific to your actual problem. In terms of the loading and displaying of the images, this can be done in the same way.
    Once you have some sort of algorithm, then you can automate the learning and matching by simply wiring them in order. (in the example, these are put in case structures as they are waiting on response from the front panel)
    I hope that this helps,
    Liam A.
    National Instruments
    Applications Engineer

  • Regular Expressions (Pattern/Matcher) --- Help

    Hi,
    I have an regex i.e. Pattern.compile("([0-9])D([0-9])'?(?:([0-9]+)\")?([NSEW])").{code}
    It has to exactly match the input e.g *45D15'34"N*
    I need to retrieve the values based on grouping.
    Group1 = 45 (degree value)
    Group2 = 15 (minutes value)
    Group3 = 34 (seconds value) ----> this is a non-capturing group
    Group4 = N (directions)
    The regex works fine for most of longitude/latitude value but I get a StackOverFlow for some. There is a known bug on this http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5050507
    According to the bug report, they have said that are many different regex that can trigger the stack overflow....even though the length of my input is not as long as the one posted on the bug report.
    I was wondering if anyone could suggest a different way of writing the regex above to avoid the stack over flow.
    Thank you in advance                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Hi,
    I missed the '+' in my original regex Pattern.compile("([0-9]+)D([0-9]+)'?(?:([0-9]+)\")?([NSEW])"){code}.
    I have also tried {code} Pattern.compile("(\\d+)D(\\d+)'?(?:(\\d+)\")?([NSEW])");And, the other 2 expressions as suggested by you.
    The problem happens when Durham Lat=”35D52’N” Lon=”78D47’W value is selected from a Jtree(the values are parsed from a xml file to the tree - the xml file has a bout 800 longitude/latitude elements for different cities in the US). It does not happen for other values and If I increment the degree or min by, then the expression works. I am not sure how else i could re-write this exp.
    Below is the snippet of the xml file:
    <State name="NORTH CAROLINA">
                <City name="Asheville AP"     Lat="35D26'N"     Lon="82D32'W"/>
                <City name="Charlotte AP"     Lat="35D13'N"     Lon="80D56'W"/>
                <City name="Durham"     Lat="35D52'N"     Lon="78D47'W"/>
                <City name="Elizabeth City AP"     Lat="36D16'N"     Lon="76D11'W"/>
                <City name="Fayetteville, Pope AFB" Lat="35D10'N"     Lon="79D01'W"/>
                <City name="Goldsboro,Seymour-Johnson"     Lat="35D20'N"     Lon="77D58'W"/>
                <City name="Greensboro AP (S)"     Lat="36D05'N"     Lon="79D57'W"/>
                <City name="Greenville"     Lat="35D37'N"     Lon="77D25'W"/>
                <City name="Henderson"     Lat="36D22'N"     Lon="78D25'W"/>
                <City name="Hickory"     Lat="35D45'N"     Lon="81D23'W"/>
                <City name="Jacksonville"     Lat="34D50'N"     Lon="77D37'W"/>
                <City name="Lumberton"     Lat="34D37'N"     Lon="79D04'W"/>
                <City name="New Bern AP"     Lat="35D05'N"     Lon="77D03'W"/>
                <City name="Raleigh/Durham AP (S)"     Lat="35D52'N"     Lon="78D47'W"/>
                <City name="Rocky Mount"     Lat="35D58'N"     Lon="77D48'W"/>
                <City name="Wilmington AP"     Lat="34D16'N"     Lon="77D55'W"/>
                <City name="Winston-Salem AP"     Lat="36D08'N"     Lon="80D13'W"/>
            </State>
    public final class GeoLine {
        /* Enum for the possible directions of longitude and latitude*/
        public enum Direction {
            N, S, E, W;
            public boolean isLongitude() {
                return (this == E || this == W);
            public boolean isLatitude() {
                return (this == N || this == S);
            public Direction getCanonicalDirection() {
                if (this == S) {
                    return Direction.N;
                } else if (this == W) {
                    return Direction.E;
                } else {
                    return this;
        private final int degree;
        private final int minute;
        private final int second;
        private final Direction dir;
        /* Recognizes longitude and latitude values that has degrees, minutes and seconds i.e. "45D15'34"N
        * or "45D1534"N. The single-quotes for the minutes is optional. And, for the moment we do not support seconds
        * validation although ilog library returns the longitude/latitude with second when NEs and Sub-networks are
        * dragged and dropped on the map.*/
    private static final Pattern PATTERN = Pattern.compile("([0-9]+)D([0-9]+)'?(?:([0-9]+)\")?([NSEW])");
        public GeoLine(int degree, int minute, Direction dir) {
            this(degree, minute, 0, dir);
        public GeoLine(int degree, int minute, int second, Direction dir) {
            Log.logInfo(getClass().getSimpleName(), "PAU degree: " + degree + " minute: " + minute + " second: " + second + " direction: " +  dir);
            verifyLongitudeLatitude(degree, dir);
            verifyMinute(degree, minute, dir);   
            this.degree = degree;
            this.minute = minute;
            this.second = second;
            if (this.degree == 0 && this.minute == 0 && this.second == 0) {
                this.dir = dir.getCanonicalDirection();
            } else {
                this.dir = dir;
        public Direction getDirection() {
            return dir;
        public int getMinute() {
            return minute;
        public int getDegree() {
            return degree;
        public int getSecond() {
            return second;
        public static GeoLine parseLine(String location) {
            * Matcher class will throw java.lang.NullPointerException if a null location
            *  is passed, null location validation is not needed.
            Matcher m = PATTERN.matcher(location);
            if(m.matches()) {
                int deg;
                int min;
                int second;
                Direction direction;
                deg = Integer.parseInt(m.group(1));
                min = Integer.parseInt(m.group(2));
                if (m.group(3) == null) {
                    second = 0;
                } else {
                    second = Integer.parseInt(m.group(3));
                direction = Direction.valueOf(m.group(4));
                return new GeoLine(deg, min, second, direction);
            } else {
                throw new IllegalArgumentException("Invalid location value. Expected format XXDXX'XX\"[NSEW] " + location);
        private void verifyMinute(int deg, int min, Direction direction) {
            /* This validation is to make sure that minute does not exceed 0 if maximum value for latitude == 90
            * or longitude == 180 is specified */
            int maxDeg = direction.isLatitude() ? 90 : 180;
            if(min < 0 || min > 59) {
               throw new NumberFormatException("Minutes is out of range. Value should be less than 60: " + min);
            if (deg == maxDeg && min > 0) {
                throw new NumberFormatException("Degree value " + deg + "D" + direction + " cannot have minute exceeding 0: " + min);
        private void verifyLongitudeLatitude(int valDeg, Direction valDir) {
               int max = valDir.isLatitude() ? 90 : 180;
               if(valDeg < 0 || valDeg > max) {
                    throw new NumberFormatException("Degree " + valDeg + valDir + " is invalid");
        public final boolean isLongitude() {
            return dir.isLongitude();
        public final boolean isLatitude() {
            return dir.isLatitude();
        @Override
        public final String toString(){
            if(minute < 10){
                return degree + "D0" + minute + dir;
            } else {
                return degree + "D" + minute + dir;
        @Override
        public boolean equals(Object obj) {
            if (obj instanceof GeoLine) {
                GeoLine other = (GeoLine) obj;          
                    return (this.degree == other.degree && this.minute == other.minute && this.second == other.second && this.dir == other.dir);
            return false;
        @Override
        public int hashCode() {
            int result = 17;
            result = result * 37 + degree;
            result = result * 37 + minute;
            result = result * 37 + second;
            result = result * 37 + dir.hashCode();
            return result;
    }Thank you again.

  • Mod_security: Access denied with code 405. Pattern match "!(GET|HEAD|POST)

    Hi all,
    After Cloning facing an issue
    mod_security: Access denied with code 405. Pattern match "!(GET|HEAD|POST)"
    and not able to get the login prompt
    EBS: 12.1.3
    DB:11G
    Please help as this is urgent.
    Regards,
    Raj.

    Hi Hussein/Srini,
    My OS details are as follows
    Source OS : OE Linux 5X
    Target : REHL
    DB : 11.2.0.3
    In my previous cloning the R12 login URL was not getting redirected to https from http. This backup was given by client last week and I completed the cloning and post cloning procedures without any error, but unable to login as the page is redirecting to https:/hostname:port/OA_HTML/AppsLogin.
    I have done the following so far, but the issue is not getting resolved.
    1) Generated JAR files using ADADMIN (Force)
    2) Compiled JSP
    3) Ran autoconfig multiple times without any error in both db and application tiers.
    4) DB alert log did not have any error.
    5) Executed relink all from APPL_TOP
    6) Able to launch http://XXXXXXXXX:XXXX/forms/frmservlet?
    Kindly help me out on this
    Regards

  • Who knows how to output some text once labview detects something I want using pattern matching(V​ision assistant)​?

    who knows how to output some text once labview detects something I want using pattern matching(Vision assistant)?
    The text is something like"Yes, this is a coin"
    Thanks!

    I attached a SubVI which I used to place an overlay next to a Pattern, found by a Pattern Match before:
    As you can see, you simply pass the image reference and the Array of Matches to the VI along with the String you want to have as an overlay next to the Match.
    I also modified your VI a bit, but didn't test it. I created an Array of clusters, each elment containing the template path along with the respective text.
    Please note that this is just a hint!
    Christian
    Attachments:
    suggestion.vi ‏146 KB
    Overlay_Txt.vi ‏24 KB

  • How to use AND,OR,NOT condition in Pattern Matching in java

    how to use AND,OR,NOT condition in Pattern Matching in java
    Please anyone give example..

    Stop asking these stupid vague questions and do some of your own research.
    Start here:
    http://www.regular-expressions.info/
    http://java.sun.com/j2se/1.5.0/docs/api/java/util/regex/Pattern.html

  • Pattern Matching and Vision Builder 6.0

    Hi,
    When I select a ROI from an image to generate a pattern matching, Builder
    saves it as a PNG file.
    If I open this pattern in other application (Paint Shop Pro 7) to modified
    it and save as a PNG file, after I can't open this file as a pattern into
    Builder, because it is considered as a not valid PNG file.
    I have tested this case in LabView 6.i and this problem doesn't appear.
    Any solution? Thanks.

    When the template is first saved in Vision Builder, pattern matching information is stored in the header of the PNG file. This information lets LabVIEW and Vision Builder know how the template was learned. Paint Shop Pro does not keep this information in the file whenever it is saved so Vision Builder will not recognize it as a valid pattern matching template.
    Jack Arnold
    Application Engineer
    National Instruments

Maybe you are looking for