Online chat, Nov. 12, on Regular Expressions

One of the new packages added in J2SE v 1.4 is java.util.regex , which provides classes for handling regular exprssions. A regular expression is a string pattern that can be used to perform sophisticated string searching and replacement. Learn more about java.util.regex and regular expressions, and get questions answered in this chat with Sun engineers Michael McCloskey and Mark Reinhold. The chat is scheduled for Tuesday, November 12 at 11:00 A.M. PST/7:00 P.M. GMT.
To join the chat, go to http://developer.java.sun.com/developer/community/chat/index.html and click on "Join the current session".

Is there an agenda? Or can we ask anything, e.g.
about the ActiveX bridge?There is no agenda. You're free to ask any question related to Java Plug-In Technology during the chat.

Similar Messages

  • Regular Expressions on an online database

    Hi everyone, I'm kinda new so if what I'm about to ask seems crazy bear with me.
    What kind of issues would be involved with using a regular expression to search an online database?
    The Site says that Java 1.4 now supports a great deal of regex functions but I'm wondering would it be possible to type a regex into some control and for t to evaluate this against what's in the Database?
    Am I making sense?
    Thanks everyone,
    Robin Spiteri.

    Normally you access a database via JDBC & SQL. So the question is whether SQL supports regular expressions; this has nothing to do with java (any version). As far as I know regexps are not part of standard SQL although this might not be true for all SQL databases --> I think you cannot use regexps directly to query a database.
    If the database you're using supports regexps, and you are really sure that this will be "THE" database, and the system won't change, you can of course included regexps in the SQL, but that'll make it difficult to move to another database
    What you definitely can do is loop through the resultset and kick out the records you don't want, e.g.
    while(rs.next()) {
      if(!matchMyRegExp(rs.getString(1))) {
        // loop if reg exp is not matched
        continue;
      // do something
    }This should work on any database, but at the cost of transferring more data than needed from the db to the application.

  • Online chat, July 16, New I/O (NIO) APIs

    The New I/.O (NIO) APIs introduced in J2SE v 1.4 provide new features and improved performance for buffer management, scalable network and file I/O, character-set support, and regular-expression matching. Learn more about the NIO APIs, and get questions answered in this online chat with two key members of Sun's NIO APIs engineering team: Mark Reinhold and Michael McCloskey. The chat is scheduled for Tuesday, July 16, from 11 A.M.-to-noon Pacific time (6 P.M.-to-7 P.M. GMT).
    To join the chat, go to http://developer.java.sun.com/developer/community/chat/ and click on "Join the current session."

    On the website it says you can create your own topic and things that imply that it's always open. Obviously not.

  • Unix Log Monitoring regular expression not picking up alerts

    Hi,
    We are moving our unix monitoring to SCOM 2012 SP1 rollup 4.
    What I have got working is indvidual alert logging of Unix Log alerts by exporting the MP and changing the <IndividualAlerts> value to true and removing the suppression xml section then reimporting the MP.
    What I am trying to do is use the regular expression to peform the suppression of specific event (such as event codes).
    The expression is:
    ((?i:warning)(?!(.*1222)|(.*1001)))
    ie Search the log for "warning" (not case sensitive) then check if events 1222 or 1001 exist if so return no match, if they dont exist then return true. 
    I use the built in test function in SCOM when creating the rule and the tests come back as expected but when I inject test lines into the unix log, no alerts get generted.
    I suspect it could be the syntax not being accepted on the system (its running RedHat 6 )
    I have tested this with regex tools and works.
    When I try and test it on the server i get:
    [root@bld02 ~]# grep ((?i:Warning)(?!(.*1222)|(.*1001))) /var/log/messages
    -bash: !: event not found
    [root@bld02 ~]# tail /var/log/messages
    Nov 13 15:07:26 bld02 root: SCOM Test Warning Event ID 1001 Round 18
    Nov 13 15:07:29 bld02 root: SCOM Test Warning Event ID 1000 Round 18
    Nov 13 15:07:35 bld02 root: SCOM Test Warning Event ID 1002 Round 18
    So I am expecting 2 alerts to be generated.
    SCOM tests to show expression working:
    Test 1 Matching
    Test 2 to exclude
    Need some help with this, Thankyou in advance :)

    Hello,
    Here's an example of modifying the MP to exclude particular events.  Firstly, I created a log file rule using the MP template that is fairly inclusive - matching the string Warning (with either a lower or upper case W).
    I then exported the MP, and modified the rule.  I set the IndividualAlerts = true and removed the AlertSuppression element, so that every matched line will fire a unique alert.  You don't have to remove the AlertSuppression, but you should use
    Individual alerts so that the exclusion logic doesn't exclude concurrent events that you actually want to match.
    Implementing the exclusion logic involves the addition of a System.ExpressionFilter definition in the rule. This will use a conditional evaluation of the //row element of the data item.  Here's an example of a dataitem matching an individual row:
    <DataItem type="System.Event.Data"time="2013-11-15T10:33:14.8839662-08:00"sourceHealthServiceId="667FF365-70DD-6607-5B66-F9F95253B29F">
    <EventOriginId>{86AB962D-2F44-29FD-A909-B99FF6FEB2C5}</EventOriginId>
    <PublisherId>{EC7EA4B1-0EA5-7E8E-701F-82FEF3367BC4}</PublisherId>
    <PublisherName>WSManEventProvider</PublisherName>
    <EventSourceName>WSManEventProvider</EventSourceName>
    <Channel>WSManEventProvider</Channel>
    <LoggingComputer/>
    <EventNumber>0</EventNumber>
    <EventCategory>3</EventCategory>
    <EventLevel>0</EventLevel>
    <UserName/>
    <RawDescription>Detected Entry: warning 1002</RawDescription>
    <CollectDescription Type="Boolean">true</CollectDescription>
    <EventData>
    <DataItem type="SCXLogProviderDataSourceData"time="2013-11-15T10:33:14.8839662-08:00"sourceHealthServiceId="667FF365-70DD-6607-5B66-F9F95253B29F">
    <SCXLogProviderDataSourceData>
    <row>warning 1002</row>
    </SCXLogProviderDataSourceData>
    </DataItem>
    </EventData>
    <EventDisplayNumber>0</EventDisplayNumber>
    <EventDescription>Detected Entry: warning 1002</EventDescription>
    </DataItem>
    Here is the rule in the MP XML.  The <ConditionDetection>...</ConditionDetection> content was what I added to do the exclusion filtering:
    <Rule ID="LogFileTemplate_66b86eaded094c309ffd2631b8367a32.Alert" Enabled="false" Target="Unix!Microsoft.Unix.Computer" ConfirmDelivery="false" Remotable="true" Priority="Normal" DiscardLevel="100">
    <Category>EventCollection</Category>
    <DataSources>
    <DataSource ID="EventDS" TypeID="Unix!Microsoft.Unix.SCXLog.VarPriv.DataSource">
    <Host>$Target/Property[Type="Unix!Microsoft.Unix.Computer"]/PrincipalName$</Host>
    <LogFile>/tmp/test</LogFile>
    <UserName>$RunAs[Name="Unix!Microsoft.Unix.ActionAccount"]/UserName$</UserName>
    <Password>$RunAs[Name="Unix!Microsoft.Unix.ActionAccount"]/Password$</Password>
    <RegExpFilter>warning</RegExpFilter>
    <IndividualAlerts>true</IndividualAlerts>
    </DataSource>
    </DataSources>
    <ConditionDetection TypeID="System!System.ExpressionFilter" ID="Filter">
    <Expression>
    <RegExExpression>
    <ValueExpression>
    <XPathQuery Type="String">//row</XPathQuery>
    </ValueExpression>
    <Operator>DoesNotContainSubstring</Operator>
    <Pattern>1001</Pattern>
    </RegExExpression>
    </Expression>
    </ConditionDetection>
    <WriteActions>
    <WriteAction ID="GenerateAlert" TypeID="Health!System.Health.GenerateAlert">
    <Priority>1</Priority>
    <Severity>2</Severity>
    <AlertName>Log File Alert: ExclusionExample</AlertName>
    <AlertDescription>$Data/EventDescription$</AlertDescription>
    </WriteAction>
    </WriteActions>
    </Rule>
    I traced this with the Workflow Analyzer as I tested, which shows the logic being applied.  Here is the exclusion happening:
    Here's more info on the definition of an ExpressionFilter:
    http://msdn.microsoft.com/en-us/library/ee692979.aspx
    And more information on Regular Expressions in MPs:
    http://support.microsoft.com/kb/2702651/en-us
    You can also have multiple Expressions in the ExpressionFilter joined by OR or AND operators.
    Also, if you are comfortable with the MP authoring, you can just skip the step of creating the rules in the MP template and just author your own MP with the VSAE tool:
    http://social.technet.microsoft.com/wiki/contents/articles/18085.scom-2012-authoring-unixlinux-log-file-monitoring-rules.aspx
    www.operatingquadrant.com

  • Regular Expressions in Oracle

    Hello All,
    I come from Perl scripting language background. Perl's regular expressions are rock solid, robust and very fast.
    Now I am planning to master Regular Expressions in Oracle.
    Could someone please point the correct place to start with it like official Oracle documentation on Regular Expressions, any good book on Regex or may be any online link etc.
    Cheers,
    Parag
    Edited by: Parag Kalra on Dec 19, 2009 11:03 AM

    Hi, Parag,
    Look under [R in the index of the SQL language manual|http://download.oracle.com/docs/cd/B28359_01/server.111/b28286/index.htm#R]. All the regular expression functions and operators start with "REGEXP", and there are a couple of entries under "regular expressions".
    That applies to the Oracle 11 and 10.2 documentation. Regular expressions were hidden in the Oracle 10.1 SQL Language manual; you had to look up some similar function (like REGR_SYY, itself hidden under S for "SQL Functions", and then step through the pages one at a time.
    Sorry, I don't know a good tutorial or introduction.
    If you find something hopeful, please post a reference here. I think a lot of people would be interrested.

  • Java Regular Expressions and Pattern

    I have a file that i first want to get all the lines that match a given pattern. Then from these lines that match i want to extract two values.
    Example line for the pattern to match
    INFO | jvm 1 | 2006/11/07 15:14:09 | INFO | Tue Nov 07 15:14:09 CET 2006 | XLDB PPS Data Dumper: MESSAGE:- 406 Processing .. '[ /opt/nexus/horizon/raw_data/network/pp_CE01S4H_sta_20050703T015717_SYDP3001_546.bdf ]'
    So all the lines that are like these i want to extract two variables
    2006/11/07 15:14:09
    and
    /opt/nexus/horizon/raw_data/network/pp_CE01S4H_sta_20050703T015717_SYDP3001_546.bdf
    so i can store these variables in a database.
    Can someone help me with writing the pattern to match and the regular express to extract? Also if anyone else has a better way of doing this i am all ears and i have a lot of log files to go through.

    import java.util.regex.*;
    class Main
      public static void main(String[] args)
        String txt="INFO | jvm 1 | 2006/11/07 15:14:09 | INFO | Tue Nov 07 15:14:09 CET 2006 | XLDB PPS Data Dumper: MESSAGE:- 406 Processing .. '[ /opt/nexus/horizon/raw_data/network/pp_CE01S4H_sta_20050703T015717_SYDP3001_546.bdf ]'";
        String re1=".*?";     // Non-greedy match on filler
        String re2="((?:2|1)\\d{3}(?:-|\\/)(?:(?:0[1-9])|(?:1[0-2]))(?:-|\\/)(?:(?:0[1-9])|(?:[1-2][0-9])|(?:3[0-1]))(?:T|\\s)(?:(?:[0-1][0-9])|(?:2[0-3])):(?:[0-5][0-9]):(?:[0-5][0-9]))";     // Time Stamp 1
        String re3=".*?";     // Non-greedy match on filler
        String re4="((?:\\/[\\w\\.]+)+)";     // Unix Path 1
        Pattern p = Pattern.compile(re1+re2+re3+re4,Pattern.CASE_INSENSITIVE | Pattern.DOTALL);
        Matcher m = p.matcher(txt);
        if (m.find())
            String timestamp1=m.group(1);
            String unixpath1=m.group(2);
            System.out.print("("+timestamp1.toString()+")"+"("+unixpath1.toString()+")"+"\n");
    }

  • Using regular expressions to find and replace code.

    Hi! Semi-newbie coder here.
    I'm trying to strip out code from multiple pages, I've tried regular expressions but I'm struggling to understand them. I also need to do it across a LOT of pages, so I need an automated way of doing it.
    The best way I can explain is with an analogy:
    I want to delete any string of characters that start with c, ends with t and includes anything inbetween, so it would pick up "cat, cut, chat, coconut, can do it" whatever appears in the middle of those.
    Except, instead of c and t, I want it to find strings of code starting with <div class="advert" and ending with Vote<br> while picking up everything in between, (including spaces, code, comments, etc.). Then, deletes that whole string including the starting and ending.Is there a regular expression I could use in dreamweaver that could do this? Is there a way to do this at all?

    Let me begin by saying I'm a complete idiot with DW's Reg Ex.   I use Search Specific Tag whenever possible.  See screenshot below.
    Try this on your Current Document to see if it works. Then make a back-up copy of site before attempting it on Entire Local Site as you cannot "Undo" this process.
    Good luck,
    Nancy O.

  • Juniper MX Regular expressions and user permissions ACS 5.4

    Hi everyone!
    Im having some trouble with regular expressions and permissions on our Juniper MX routers through ACS 5.4, and i would like some insight/help/poitners!!
    We have a team of engineers that should only have read only permissions (important: show configuration) and also be able to just change the description on interfaces.
    Thus far with the following regular expressions set for the shell profile they are going through i have managed the above, however the problem is when an engineer inputs "Show configuration", only the interfaces descriptions configuration is shown! The rest of the configuration will not be printed.
    deny-commands1=.*.
    allow-commands1=configure
    deny-configuration1=.*.
    allow-commands2=interfaces .*. description .*$
    allow-configuration1=interfaces .*. description .*$
    allow-commands2=show configuration.*
    allow-commands3=show configuration
    (some of these regex i know that are not needed, i was just playing around to check everything before posting)
    Any pointers as to why or how to resolve this?
    example output with the above:
    show configuration
    ## Last commit: 2014-01-09 09:34:44 EET by someone
    interfaces {
        xe-0/0/0 {
        xe-0/0/1 {
            description xxxx;
        xe-0/1/0 {
            description xxxx;
        xe-0/1/1 {
            description xxxx;
        xe-0/2/0 {
            disable;
        xe-0/2/1 {
            description xxxx;
        xe-0/3/0 {
            description xxxx;
        xe-0/3/1 {
            description xxxx;
        ae0 {
            description "xxxx";
        ae1 {
            description xxxx;
        demux0 {
        lo0 {
    {master}
    Thanks in advance!
    Spyros

    You are absolutely right!!  I was doing research online after posting the above.  The correct RADIUS attribute to use is actually CVPN3000/ASA/PIX7.x-Group-Based-Address-Pools.  Then create the pool in ASA, and call that pool's name in ACS under that RADIUS attribute.  Someone explained this perfectly in this community before.  Much appreciate your answer!
    Here's from another post last year:
    ACS  5 does not have the feature of IP pools. Logically its always good to  setup pools locally on vpn server and if you want user to pick ip from  specific local pool you can configure acs to push that attribute.
    On ACS Go to > Policy Elements  -> Network Access ->   Authorization Profiles -> Create ->
    Name of the Policy ->Dictionary Type: Radius-Cisco VPN 3000/ASA/PIX7.x
    Attribute Type : CVPN3000/ASA/PIX7.x-Group-Based-Address-Pools
    Attribute Type: String
    Attribute Value : Static MYPOOL (Name of the Pool which is defined on the ASA)
    Access Policies ->Default Network Access -> Authorization ->  Create -> Under result section call the Authorization p

  • Java.util.regex  vs jarkata-oro on regular expression

    hi, all
    Both java utility (java.util.regex) and jarkata-oro (org.apache.oro.text.perl) provide supports of Perl5 compatible regular expressions. What are your opinions of which one do you choose?
    I've searched in this forum and others online. I don't see this topic. Maybe I miss something...
    Anyway, your opinions/experences are more than welcome.
    thx
    Tim

    One big difference:
    java.util.regex is JAVA 1.4+ only.
    jarkata-oro is JAVA 1.2+

  • Question sql and regular expressions

    I am trying to write a query where a like with a regular % wont work.
    select <cols>
    from <tab>
    where col2 starts with 'SOME CHARACTERS' The field can have 0 or more empty spaces before there are more characters. However, I know what those characters are. How do I do 0 or more characters?
    select mycols
    from myemptable
    where empname like 'JO%JO'There could be 0 or more empty spaces between JO and JO, but the next character is 'JO' . This is a general case. So it could be something else.
    so % won't work. since i could get back 'JO HA JO' which I dont want.

    Regular expressions where introduced with Unix in 1973.
    It shouldn't be difficult to find online resources.
    You seem to belong to the big class of users in this forum who doesn't know how to use the Internet, or find that to demanding.
    The solution can of course be found in 5 minutes, of 2 to start my database especially for you at almost midnight.
    with a as (select 'JO JO' col1 from dual
                  union
                   select 'JO    JO' col1 from dual
                   union
                  select 'JO HA JO' col1 from dual
                  union all
                  select 'JO  JO BLEH' from dual)
       select * from a where regexp_like(col1,'^JO( +)JO.*$')
    You find out what it means as exercise.
    Sybrand Bakker
    Senior Oracle DBA

  • Esing regular expression to reformat text (match & replace)

    Hi guys ..I am using regilar expression to reformat logs files..
    this is how i match the pattern..
    Pattern pattern = Pattern.compile("^<[^>]*>(.{6}).....
    Matcher matcher = pattern.matcher(thisLine);
    then prints the output...
    myOutput.print(matcher.group(1));
    It works..however my prob now is, i am reading a date in format "8 Nov"
    How can i change this to 8-11-2005 ????

    hmmm....ya..i can see the idea
    (\\d\\d?) (Jan|Feb|Mar|Apr|May|Ju[nl]|Aug|Sep|Oct|Nov|Dec) means that the month can be either one rite?
    but the thing is..its collected and put in a group. for example:
    Pattern pattern = Pattern.compile("^<[^>]*>(.{6}) ...
    myOutput.print(matcher.group(1));
    the first regular expression is group in group(1). its working..it can detect the text in group(1) the problem was...i tried this..
    String priority = matcher.group(6);
                   if (priority=="3")
                        System.out.print("AAA\n");
                   else
                   System.out.print("BBB\n");
    it keeps on printing BBB even there is a "priority=3".

  • Regular Expressions - Questions to SME

    Ralph Benzinger presented an online meetup on the topic of Regular Expressions.  The presentation (slides only) can be found <a href="http://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/866072ca-0b01-0010-54b1-9c02a45ba8aa">here</a>
    Unfortunately the recording is not going to be available, but Ralph has been generous enough to agree to answer questions posted to this sticky thread.
    cheers,
    Marilyn

    Hello Peter,
    You're welcome!
    Alas, I was unable to locate the regex documentation on help.sap.com either.  In fact, I'm not even sure it has already been updated for 2004s.  I recommend that you use the online documentation within the system, e.g., from transactions SE38 or SE80.  Do an index search for "regex", and you'll be directed to REGEX, FIND and REGEX, REPLACE, both of which have extensive subsections on regexes.
    The class cx_sy_regex is an exception class that is thrown by FIND, REPLACE and cl_abap_regex in case of an invalid regex, such as ".\1" (there is no capture group that back reference \1 can refer to).  If the pattern is known statically, the syntax check will report this error, but for statements like "FIND REGEX pat IN text.", the actual pattern is only known at runtime.
    The cx_sy_matcher class (and its subclasses) similarly indicate some invalid states, for example trying to call "cl_abap_matcher->replace_found( )" when the matcher has no current match to replace (e.g., replace_found( ) called twice in a row).
    Please let me know if I can provide some additional information.
    Regards
    Ralph

  • Regular expressions for xml parsing

    I have a xml parsing problem that I have to solve using regular expressions. It's not possible for me to use a different method other than regular expression. But there is a problem that I cannot seem to rap my head around. I want to extract the contents of a tag but the problem is that this tag occurs serveral times in the XML file but I only want the contents of one particular occurence. Basically the problem is as follows;
    I want to extract
    <bp:NAME ***stufff***>(I want this part)</bp:NAME>This tag can occur is serval places. For example here;
    <bp:ORGANISM>
    ***bunch of tags***
    <bp:NAME ***stufff***>***stufff***</bp:NAME>
    ***bunch of tags***
    </bp:ORGANISM>or here;
    <bp:DATABASE>
    ***bunch of tags***
    <bp:NAME ***stufff***>***stufff***</bp:NAME>
    ***bunch of tags***
    </bp:DATABASE>I do not want the content of those tags. I want the content of the <NAME> tag that is not between either the <ORGANISM> tags or the <DATABASE> tags. These tags can be in any order. I for the life of me cannot seem to figure this problem out. I tried several different approaches. For example I tried using the following regex
    (?:<bp:NAME [^>]*>([^<]*).*?<bp:ORGANISM>.*?</bp:ORGANISM>|
    <bp:ORGANISM>.*?</bp:ORGANISM>.*?<bp:NAME [^>]*>([^<]*))This kind of works, the information I want is either in the first captured group or in the second one. So I just check which group is not empty and that is the one I want. But this only works if there is only one other tag containing the name tag (in this particular regular expression that is the organism tag). Since there is another tag (the database tag) I have to work around, and these tags can be in any order, the regular expression then becomes three times as large and then there are six different groups in which the information I want can occur. This does not seem like a good idea to me. There has to be another way to do this. So I tried using the following regex;
    (?:</bp:ORGANISM>)?.*?(?:</bp:DATABASE>)?.*?<bp:NAME [^>]*>([^<]*)I thought this would get rid of any occurences of the other tags in front of the name tag, but it doesn't work either. It seems like it is not greedy enough. Well I think you get the point. I don't know what to try next so I really need some help.
    Here is an example of the type of data I will run into. The tags can be in any order and they do not always have to occur. In the example below the <DATABASE> tag is not part of the data and the name tag I want just happens to be in front of the organism tag but this is not always the case. The name tag I want is the firstname tag in the file, namely;
    <bp:NAME rdf:datatype="xsd:string">Progesterone receptor</bp:NAME>So I don't want the name tag that is in between the organism tags.
    <bp:protein rdf:ID="CPATH-27885">
    &#8722;<bp:COMMENT rdf:datatype="xsd:string">
    Belongs to the nuclear hormone receptor family. NR3 subfamily. SIMILARITY: Contains 1 nuclear receptor DNA-binding domain. WEB RESOURCE: Name=NIEHS-SNPs; URL="http://egp.gs.washington.edu/data/pgr/"; WEB RESOURCE: Name=Wikipedia; Note=Progesterone receptor entry; URL="http://en.wikipedia.org/wiki/Progesterone_receptor"; GENE SYNONYMS: NR3C3. COPYRIGHT:  Protein annotation is derived from the UniProt Consortium (http://www.uniprot.org/).  Distributed under the Creative Commons Attribution-NoDerivs License.
    </bp:COMMENT>
    <bp:SYNONYMS rdf:datatype="xsd:string">Nuclear receptor subfamily 3 group C member 3</bp:SYNONYMS>
    <bp:SYNONYMS rdf:datatype="xsd:string">PR</bp:SYNONYMS>
    <bp:NAME rdf:datatype="xsd:string">Progesterone receptor</bp:NAME>
    &#8722;<bp:ORGANISM>
    &#8722;<bp:bioSource rdf:ID="CPATH-LOCAL-112384">
    <bp:NAME rdf:datatype="xsd:string">Homo sapiens</bp:NAME>
    &#8722;<bp:TAXON-XREF>
    &#8722;<bp:unificationXref rdf:ID="CPATH-LOCAL-112385">
    <bp:DB rdf:datatype="xsd:string">NCBI_TAXONOMY</bp:DB>
    <bp:ID rdf:datatype="xsd:string">9606</bp:ID>
    </bp:unificationXref>
    </bp:TAXON-XREF>
    </bp:bioSource>
    </bp:ORGANISM>
    <bp:SHORT-NAME rdf:datatype="xsd:string">PRGR_HUMAN</bp:SHORT-NAME>
    &#8722;<bp:XREF>
    &#8722;<bp:relationshipXref rdf:ID="CPATH-LOCAL-112386">
    <bp:DB rdf:datatype="xsd:string">ENTREZ_GENE</bp:DB>
    <bp:ID rdf:datatype="xsd:string">5241</bp:ID>
    </bp:relationshipXref>
    </bp:XREF>
    &#8722;<bp:XREF>
    &#8722;<bp:unificationXref rdf:ID="CPATH-LOCAL-112387">
    <bp:DB rdf:datatype="xsd:string">UNIPROT</bp:DB>
    <bp:ID rdf:datatype="xsd:string">P06401</bp:ID>
    </bp:unificationXref>
    </bp:XREF>
    &#8722;<bp:XREF>
    &#8722;<bp:unificationXref rdf:ID="CPATH-LOCAL-112388">
    <bp:DB rdf:datatype="xsd:string">UNIPROT</bp:DB>
    <bp:ID rdf:datatype="xsd:string">A7X8B0</bp:ID>
    </bp:unificationXref>
    </bp:XREF>
    &#8722;<bp:XREF>
    &#8722;<bp:relationshipXref rdf:ID="CPATH-LOCAL-112389">
    <bp:DB rdf:datatype="xsd:string">GENE_SYMBOL</bp:DB>
    <bp:ID rdf:datatype="xsd:string">PGR</bp:ID>
    </bp:relationshipXref>
    </bp:XREF>
    &#8722;<bp:XREF>
    &#8722;<bp:relationshipXref rdf:ID="CPATH-LOCAL-112390">
    <bp:DB rdf:datatype="xsd:string">REF_SEQ</bp:DB>
    <bp:ID rdf:datatype="xsd:string">NP_000917</bp:ID>
    </bp:relationshipXref>
    </bp:XREF>
    &#8722;<bp:XREF>
    &#8722;<bp:unificationXref rdf:ID="CPATH-LOCAL-112391">
    <bp:DB rdf:datatype="xsd:string">UNIPROT</bp:DB>
    <bp:ID rdf:datatype="xsd:string">Q9UPF7</bp:ID>
    </bp:unificationXref>
    </bp:XREF>
    &#8722;<bp:XREF>
    &#8722;<bp:unificationXref rdf:ID="CPATH-LOCAL-113580">
    <bp:DB rdf:datatype="http://www.w3.org/2001/XMLSchema#string">CPATH</bp:DB>
    <bp:ID rdf:datatype="http://www.w3.org/2001/XMLSchema#string">27885</bp:ID>
    </bp:unificationXref>
    </bp:XREF>
    </bp:protein>Edited by: Dani3ll3 on Nov 19, 2009 2:51 AM

    Dani3ll3 wrote:
    Thanks a lot after I did that the regular expression worked. :)Good. But remember that in real life, you would then have to apply the XML rules to get the actual contents of the text node. For example it might be a CDATA section or it might include characters like ampersands which have been escaped and which you need to unescape. That's why it's better to use a proper parser, as already suggested.
    It seems to me this forum is full of posts where people are doing homework questions which teach them to do things the wrong way. But of course there's nothing the student can do about that.

  • Regular expression to change erroneous JSTL information fails

    // THIS IS WHAT TO LOOK FOR: <c:param name="[name]" value="<%= [value] %>" />
      if (stuff.indexOf(".com/jstl") >= 0) {
       stuff = stuff.replaceAll(".com/jstl", ".com/jsp/jstl");
      Matcher matcher = Pattern.compile("(<c:param[ \\t]+name=\"[^\"]+\"[ \\t]+value=\")<%=([^%=\"]+)%>(\".*$)").matcher(stuff);
      if (matcher.matches()) {
        matcher.replaceAll("$1\${$2}$3");
      }What I am trying to do is very simple but brain-numbing for the past few days. I found out that about 100 different JSP scripts have the wrong information:
    <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
    <c:import name="header.jsp" context="/globals" >
       <c:param name="path" value="<%= path %>" />
    </c:import>What I am supposed to apparently have is this:
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <c:import name="header.jsp" context="/globals" >
      <c:param name="path value="${path}" />
    </c:import>
    {code}
    But changing 100 scripts manually is extremely hard especially when you don't know where they are among the 250 other scripts within the entire portal.  Thus, I wrote a Java class I can run from the command-line to do this for me, however, the regular expression pattern I selected to make the change constantly fails.
    I can't seem to figure out why it fails as I've tested using various online regular expression testers and it's the most accurate assuming Java uses POSIX. 
    Help very much appreciated, thanks                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    Phil_The_Lifeless_Programmer wrote:
    I don't see how you proposed that solution, unless you proposed it in a way that I could not understand, it sounded as if you were trying to point out flaws w/o a solution.I pointed out the flaws along a solution. You specified only one backslash in the replacement pattern. A backslash is an escape character in String. You need to add one more backslash to represent an actual backslash. You are invoking Matcher#replaceAll() without doing anything with its result and expected that changes are reflected in 'stuff'. I pointed that out too, along with the recommendation that you need to assign and use its return value.
    It might be my English or your stressfull head that you misunderstood it. But don't complain that I didn't give the solution. Or do you only qualify complete code snippets as a solution?
    I forgot to also mention that you have to run the Java class program multiple times manually in spite of the while loop. It appears to only replace the very last instance of the pattern in the file and nothing else. If you manually run it multiple times only then does it replace each line, from last to first.Your regex might just be wrong, it look like that it only matches the first occurrence. I am not an advanced regex expert, so I can't say much about this. Consider reposting this question (in a more friendly form!) in the Java Programming forum. There walk a lot of regex guru's around, e.g. uncle_alice, sabre150 and prometheuzz.
    Good luck, man. And please take a breathe.

  • Data generation using regular expression in c# for sql server

    Hello Everybody,
    I am using VS 2013 professional, SQL Server 2012.
    I am writing database application in c#. I have a table which stores starttime and endtime of operator
    As starting step, I inserted random DateTime into the table.
    But i would like hide some Patterns inside the database like it should insert some records that operator2 is absent on every second tuesday in every month in 2014 between 3AM to 4AM.
    How do i tell my c# code to insert that Patterns into databse. From some posts I understtod that it may be done by using regular expressions. But i did not find clear example.
    Could someone please tell me how to do it?
    Thank you so much.

    I'm not sure what exactly you're referring to, but I think you may be able to accomplish some of what you want by using triggers, constraints, and column defaults. These are database objects that are defined by using DDL, so have a look at the DDL reference
    (and other information about these objects) in SQL Server Books Online and see if these will do what you want. T-SQL implements a "pattern-wildcard language" that is not the same as regular expressions.
    In addition you can write SQLCLR objects (e.g. triggers and functions) that can use the .NET regular expression library, which is an implementation of the well-known regular expression library. There are a number of examples of SQLCLR/regular expressions
    around, a simple web search should suffice.
    Hope this helps, Bob

Maybe you are looking for

  • Convert byte array to table of int

    [http://www.codeproject.com/KB/database/PassingArraysIntoSPs.aspx?display=Print|http://www.codeproject.com/KB/database/PassingArraysIntoSPs.aspx?display=Print] Hello friends. I'm pretty new with PL/SQL. I have code that run well on MSSQL and I want t

  • Old GR/IR balances

    Hi experts, If i run MB5S, i found few documents lying in the system with GR/IR balances. If i want to clear these documents what are the different options available.? 1) If I want to settle to vendor, (for the GRs done for the POs few years back), i

  • Issue in maintaining the freight condition in SRM pricing conditions

    Hi All, We have maintained the freight condition in SRM pricing conditions But when a buyer try to add the freight condition it does not give any field to add the value.We want the freight condition at the header level. Let me know if there is any se

  • IPhoto crashes when I try to import photos

    Hi, My iPhoto keeps crashing whenever I attempt to import photos. I've tried to import via SD card and via file folder. I didn't have this issue before the Yosemite update, not sure if that has anything to do with it. Any help is greatly appreciated.

  • How can I get unsorted bookmarks on the "Bookmarks" menu so I do not have to open the "Library" It is a pain in the ***.

    When I click on Bookmarks, folders I created are shown but I can not move the Unsorted Bookmarks to that menu. I have to open the Library to see it. I have copied it to a folder but it does not update it when a new bookmark is created. I know I can o