Reular expressions API in v1.3.1
hi,
is there any package like java.util.regex of java version 1.4.1 in java version 1.3.1? is it possible to use regular expressions in 1.3.1 version? i need methods like matches() and replaceAll() in Matcher class of version 1.4.1
if not, is there any external packages for this purpose?
http://jakarta.apache.org
Look at 'Regexp' and 'ORO'
Similar Messages
-
Guys, sorry for silly question. I'm sort of stuck. How can I access APEX API's packages? I mean where they are?
In the apex editor, If you look in the "Application Express User's Guide" (i.e. the "help" section), there is a chapter headed "Oracle Application Express APIs". For the absolute avoidance of doubt, the user guide can be found at very top right-hand corner of the apex development page, next to the "logout" button - its labelled "Help" (rather aptly, I think).
As a more general point (i.e. not specifically you), everyone should browse through this or, even better, run through the 2 day developer course, before coming near the forum - it would save everyone a lot of grief in the long run! :-) -
Hello every body. My question is simple. Can I use regular expresions API in JDK 1.3?
Thanks in advance :)interesting idea.
I do not believe you can use 1.4's regular expression package because i think it uses a bunch of other apis that are also new to 1.4 like channels and nio but i could be very wrong about that.
however, you can upgrade your java version or simply get the open source package .
Stephen -
Regular expressions API in v1.3.1
hi,
is there any package like java.util.regex of java version 1.4.1 in java version 1.3.1? is it possible to use regular expressions in 1.3.1 version? i need methods like matches() and replaceAll() in Matcher class of version 1.4.1
if not, is there any external packages for this purpose?You can use ORO from Apache Jakarta Project.
"The Jakarta-ORO Java classes are a set of text-processing Java classes that provide Perl5 compatible regular expressions, AWK-like regular expressions, glob expressions, and utility classes for performing substitutions, splits, filtering filenames, etc. "
URL: http://jakarta.apache.org/oro/index.html -
Has anyone got the QTP "Siebel Test Optimizer/Express API" workng?
Hi,
We are trying to demo the "test optimizer" (earlier called "test express") capability of synchronizing the siebel repository with the QTP object repository.
We have tried installing the EAR files given by Oracle on both JBoss and Weblogic servers but keep getting an error "database name lookup failed" when trying to connect QTP to Siebel via the test optimizer wizard.
Siebel version is 8.0
Please let us know if anyone has managed to get this working and detailed steps / any error encountered and their resolution!
Regards,
HemantHi,
I know it's a little too late to reply to this thread but wanted to know if you were able to figure out the problem. If not, please reply back and I think I will be able to help you out.
Regards,
Rahul -
API extracting keywods from text files
hi all,
i will be grateful if any of you can suggest some free java api which can be used to extract keywords from text files.
thanx in advance
mallsjava.util.regex - regular expressions API in JDK 1.4
-
Regular Expressions and String variables
Hi,
I am attempting to implement a system for searching text files for regular expression matches (similar to something like TextPad, etc.).
Looking at the regular expression API, it appears that you can only match using string variables. I just wanted to make sure this is true. Some of these files might be large and I feel uneasy about loading them into ginormous Strings. Is this the only way to do it? Can I make a String as big as I want?
Thanks,
-MikeNewlines are only a problem if you're reading the
text line-by-line and applying the regexp to each
line. It wouldn't catch expressions that span
lines.
@sabre150: your note re: CharSequence -- so what
you're suggesting is to implement a CharSequence that
wraps the file contents, and then use the regexps on
the whole thing? I like the idea but it seems like
it would only be easy to implement if the file uses a
fixed-width character set. Or am I missing
something...?You are correct for the most basic implementation. It is very easy to create a char sequence for fixed width character sets using RandomAccessFile. Once you go to character sets such as UTF-8 then more effort is required.
While ever the regex is moving forward thought the CharSequence one char at a time there is no problem because one can wrap a Reader but once it backtracks then one needs random access and one will need to have a buffer. I have used a ring buffer for this which seems to work OK but of course this will not allow the regex to move to any point in the CharSequence.
'uncle_alice' is the regex king round here so listen to him.
:-( I should read further ahead next time!
Message was edited by:
sabre150
Message was edited by:
sabre150 -
ANN: New Regular Expressions Sample
Hi,
Regular expressions introduced in Oracle 10g Database is one of the most powerful ways of searching, manipulating and transforming text data.
Check out this new [url http://www.oracle.com/technology/sample_code/tech/pl_sql/regexp/dnasample/readme.html]DNA Analysis Sample, that uses the regular expression APIs to identify certain enzyme patterns in a DNA Sequence.
Also visit the [url http://www.oracle.com/technology/sample_code/tech/pl_sql/index.html]PL/SQL Sample Code page for more samples on PL/SQL.
Thanks
Shrinivas
OTN TeamThis bunch of samples does not currently have one. We will look at it.
Cheers,
-- Rajesh -
Regular expressions: serious design flaw?
I wondered why sometimes, the replaceAll() method works in my code and sometimes it throws a java.util.regex.PatternSyntaxException. I wrote a little test case to show the problem
private void regularExpressionTest() {
String escapers = "\\([{^$|)?*+."; //characters to escape to avoid PatternSyntaxException
String text = "The quick brown fox jumps over the lazy dog.";
System.out.println("Original: "+text);
String regExp = "o";
String word = "HELLO";
String result = text.replaceAll(regExp, word);
System.out.println("Replace all '"+regExp+"' with "+word+": "+result);
text = "The quick brown {animal} jumps over the lazy dog.";
System.out.println("Original: "+text);
regExp = "{animal}";
// regExp = escapeChars(regExp, escapers); //escape possible regular expression characters
word = "catterpillar";
result = text.replaceAll(regExp, word);
System.out.println("Replace all '"+regExp+"' with "+word+": "+result);
}//regularExpressionTest()The output is:
Original: The quick brown fox jumps over the lazy dog.
Replace all 'o' with HELLO: The quick brHELLOwn fHELLOx jumps HELLOver the lazy dHELLOg.
Original: The quick brown {animal} jumps over the lazy dog.
java.util.regex.PatternSyntaxException: Illegal repetition
{animal}
at java.util.regex.Pattern.error(Pattern.java:1528)
at java.util.regex.Pattern.closure(Pattern.java:2545)
at java.util.regex.Pattern.sequence(Pattern.java:1656)
at java.util.regex.Pattern.expr(Pattern.java:1545)
at java.util.regex.Pattern.compile(Pattern.java:1279)
at java.util.regex.Pattern.<init>(Pattern.java:1035)
at java.util.regex.Pattern.compile(Pattern.java:779)
at java.lang.String.replaceAll(String.java:1663)
at de.icomps.prototypes.Test.regularExpressionTest(Test.java:57)
at de.icomps.prototypes.Test.main(Test.java:34)
Exception in thread "main" As the first replacement works as espected, the second throws an Exception. Possible because '{' is a special character for the regular expression API. In case I know the regular expression, i could escape these special characters. But in my generic server app, the strings are all parameters, so the only way for replaceAll() to work is, to escape all possible special characters in the regular expression.
1. Is there a complete list of all special characters for regular expressions that need to be escaped?
2. Is there a similar replaceAll() method without regular expressions? So that all occurences of a substring can be replaced by another string? (So far, I wrote my own method but this is of course more time consuming for massive string operations.)1. The complete list of specially-recognized characters are listed in the Java 1.4.* API. (Of course, new ones may eventually be added as the regex package matures).
2. It is time consuming to program in general. You should have written your own utility method that goes through a String using indexOf and building up the String in a StringBuffer, and apparently you did. Now you have the utility method...you no longer need to write that method again.
3. Or you could have written some kind of method that automatically escapes the specially-recognized characters... -
Spliting a large string using regular expression which contain special char
I have huge sting(xml) containing normal character a-z,A-Z and 0-9 as well as special char( <,>,?,&,',",;,/ etc.)
I need to split this sting where it ends with </document>
for e.g.
Original String:
<document>
<item>sdf</item>
<item><text>sd</text</item>
</document>
<document>hi</document>
The above sting has to be splited in to two parts since it is having two document tag.
Can any body help me to resolve this issue. I can use StringTokenizer,String split method or Regular expression api too.manas589 wrote:
I used DOM and sax parser and got few exception. Again i don't have right to change xml. so i thought to go with RegularExpression or some other way where i can do my job.If the file actually comes in lines like what you posted, you should just be able to compare the contents of each line to see if it contains "</document>" or whatever you're looking for. I wouldn't use regex unless I needed another problem.
I got excpetion like: Caused by: org.xml.sax.SAXParseException: The entity "nbsp" was referenced, but not declared.
at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
at org.apache.xerces.util.ErrorHandlerWrapper.fatalError(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)So then it isn't even XML.
Edit: sorry, I just realized why you're considering all of these heavy-duty ideas. It's just that you don't know how to break the string into lines. You do it like this:
BufferedReader br = new BufferedReader(new StringReader(theNotXMLString)); -
Java regular expression for CSV?
I found several regular expressions in the internet to parse/split csv data lines. Howeverm, they all don't work with the Java regular expression API. Is there a regular expression to tokenize CSV fields for the Java regexp API?
If the licensing of the above solution is too restrictive for you...I'm sure there are other types of parsers out there that do that type of thing.
In the meantime, here is some code I cooked up (no GPL...use it freely) that might get you started.
Don't know that it handles everything, but I never said it would...
Please READ and let me know what changes could be made. I'm always looking for improvements in my understanding of regular expressions...
import java.util.regex.*;
import java.util.*;
import java.util.List;
public class Example
final static Pattern CSV_PATTERN;
final static Pattern DOUBLE_QUOTE;
static
String regex = "(?: ([^q;]+) | (?: q ((?: (?:[^q]+) | (?:qq) )+ ) q) );?";
// 1 2 a b 3 4
// So, pretend your quote character is q
// (you can change it to \" later when you understand what's going on.)
// This regex (when applied iteravely) matches a token that:
// 1) contains NO QUOTE MARKS whatsoever (;'s) (in group 1)
// or
// 2) starts with a QUOTE, then contains either
// a) no quotes at all inside or
// b) double quotes (to escape a quote)
// 3) and ends with a QUOTE.
// 4) and is followed by a separator (optional for the last value)
// Note that (a) and (b) are captured in group 2 of the regex.
CSV_PATTERN = Pattern.compile(regex, Pattern.COMMENTS);
DOUBLE_QUOTE = Pattern.compile("qq");
* Attempts to parse Excel CSV stuff...
* @param text the CSV text.
* @return a list of tokens.
public static List parseCsv(String text)
Matcher csvMatcher = CSV_PATTERN.matcher(text);
Matcher doubleQuotes = DOUBLE_QUOTE.matcher("");
List list = new ArrayList();
while (csvMatcher.find())
if (csvMatcher.group(1) != null)
// The first one matched.
list.add(csvMatcher.group(1));
else
doubleQuotes.reset(csvMatcher.group(2));
list.add(doubleQuotes.replaceAll("q"));
return list;
} -
Hi,
I have a master-detail relation between 2 persistent classes. In java terminology, a master instance has a Collection of detail instances. I need to find master instances for which the collection contains detail 1 AND detail 2.
Example: Find all Employees having a Project with name="BigProject" AND a Project with budget="10000"
Note that the 2 conditions may be satisfied by 2 different projects. In other words, I don't mean "having a Project with (name="..." AND budget="...")
The following query pattern on the detail table returns the desired results :
SELECT DISTINCT <master id field>
FROM <detail table> t0
WHERE (t0.<field> = 'a value')
intersect
SELECT DISTINCT <master id field>
FROM <detail table> t0
WHERE (t0.<other field> = '<another value')
I don't know how to generate this, intersect is not in the Expression API.
Any ideas ?
JCGHi,
Here are some example expressions that I think will work:
ExpressionBuilder builder = new ExpressionBuilder(Employee.class);
Expression final =
builder.anyOf("projects").get("name").equal("BigProject").and(builder.anyOf
("projects".get("budget").equal("10000"));
This will return employees that have a Project named "BigProject" and a Project with budget "10000"
Another simliar expression:
Expression firstJoin = build.anyOf("projects");
Expression final = firstJoin.get("name").equal("BigProject").and(firstJoin.get("budget").equal("10000"));
This will return the employees who have a Project named "BigProject" with a budget of "10000". This is the situation you did not want.
Hope this helps.
Karen -
Change login page and logout_url
I created with apex 2.1 a new login page.
How/where can I reset the login process to page 1 or page 101 ?
Where can I edit which page corresponds with LOGOUT_URL ?
In Shared Components > Security > Authentication Schemes > Change > Next
I can see which page corresponds at the moment, but I do not know where to change these settings
(Authentication schema is the default Application Express)
The string looks like:
wwv_flow_custom_auth_std.logout?p_this_flow=&APP_ID.&p_next_flow_page_se
ss=&APP_ID.:102I just had a look at the documentation and realize it was slightly different back in 2.1.
You need to use the LOGOUT procedure rather than just setting it in shared components:
Here is the link to the documentation:
http://download.oracle.com/docs/cd/B25329_01/doc/appdev.102/b25309.pdf
If you search for the "LOGOUT Procedure" which part of the Oracle Application Express API's it gives an example of how it used.
There is also a procedure API for the login which can also be searched for under "LOGIN Procedure" and also has an example of how it can be used.
Thanks
Paul -
Re: [iPlanet-JATO] Re: CSpMultiSQL after migration
Alex,
I just switched over to Netscape Messenger from OutLook and I didn't
realize that emails were displayed in threaded hierarchies and therefore
did not see that you had already had responses to your post. Sorry for
the confusion in my previous response.
matt
njdoe123 wrote:
Hi,
I have tested another simple MultiSQL. The Update, Delete, Insert
are not funcitonal. I'm using only one single database table (no
join). It worked great in netD. The database is Oracle.
We're using migtoolbox-1.1.1 with Jato 1.1. Do we have to modify
the UpdataQueryModel.java file or other ? Or could i use jato 1.2
to replace 1.1 ?
The following is log from AppServer. Could i receive the migtool
1.2 beta ?
Thanks,
Alex Lin
<Dec 21, 2001 11:18:36 AM PST> <Error> <HTTP> <[WebAppServletContext
(1572805,Tes
t3AppWar,/Test3AppWar)] Root cause of ServletException
com.iplanet.jato.model.ModelControlException
java.sql.SQLException: ORA-00933: SQL command not properly ended
at oracle.jdbc.dbaccess.DBError.throwSqlException
(DBError.java:168)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:208)
at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:543)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7
(TTC7Protocol.java:1405)
at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch
(TTC7Protocol.java:822
at oracle.jdbc.driver.OracleStatement.executeNonQuery
(OracleStatement.ja
va:1446)
at oracle.jdbc.driver.OracleStatement.doExecuteOther
(OracleStatement.jav
a:1371)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout
(OracleStateme
nt.java:1900)
at oracle.jdbc.driver.OracleStatement.executeUpdate
(OracleStatement.java
:693)
at com.iplanet.jato.model.sql.QueryModelBase.executeUpdate
(QueryModelBas
e.java:1788)
at com.iplanet.jato.model.sql.QueryModelBase.update
(QueryModelBase.java:
420)
at
com.iplanet.jato.view.RequestHandlingViewBase.executeAutoUpdatingMode
l(RequestHandlingViewBase.java:1070)
at
com.iplanet.jato.view.RequestHandlingViewBase.executeAutoUpdatingMode
ls(RequestHandlingViewBase.java:938)
at
com.iplanet.jato.view.RequestHandlingViewBase.handleWebAction(Request
HandlingViewBase.java:821)
at Test3App.Test3.PgUpdateViewBean.handleUpdateRequest
(PgUpdateViewBean.
java:838)
at java.lang.reflect.Method.invoke(Native Method)
at com.iplanet.jato.view.RequestHandlingViewBase.handleRequest
(RequestHa
ndlingViewBase.java:341)
at
com.iplanet.jato.view.ViewBeanBase.invokeRequestHandlerInternal(ViewB
eanBase.java:481)
at com.iplanet.jato.view.ViewBeanBase.invokeRequestHandler
(ViewBeanBase.
java:431)
at com.iplanet.jato.ApplicationServletBase.dispatchRequest
(ApplicationSe
rvletBase.java:645)
at com.iplanet.jato.ApplicationServletBase.processRequest
(ApplicationSer
vletBase.java:431)
at com.iplanet.jato.ApplicationServletBase.doPost
(ApplicationServletBase
.java:296)
at javax.servlet.http.HttpServlet.service
(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service
(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet
(ServletStubIm
pl.java:265)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet
(ServletStubIm
pl.java:200)
at
weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
rvletContext.java:2456)
at weblogic.servlet.internal.ServletRequestImpl.execute
(ServletRequestIm
pl.java:2039)
at weblogic.kernel.ExecuteThread.execute
(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run
(ExecuteThread.java:120)
--- In iPlanet-JATO@y..., "Matthew Stevens" <matthew.stevens@E...>
wrote:
EDITED
-----Original Message-----
From: Matthew Stevens [mailto:<a href="/group/SunONE-JATO/post?protectID=029166114165042198028082000056130080177026031196061130152150">matthew.stevens@e...</a>]
Sent: Thursday, December 20, 2001 4:32 PM
Alex,
If your implied question is, "Looks like the iMT did not migrate
this block
of code. What is my next step?" Then I have an answer for you. If
I
misinterpreted your email then please clarify.
The procedure for ND migration using the iMT (as outlined in the
documentation
under <iMT_install_dir>/docs) is that customized code originally
provided by
the ND developer is purposely commented out so that the file can
compile.
Our experience in migration efforts shows that it is preferrable to
the
migrator to be able to select which part of the application they
want to
work
on by uncommenting specific blocks of code - allowing for
incremental
edit/compile/test cycles. If we left all this arbitary code un-
commented,
then nothing would compile after migration and you would have a huge
roadblock for moving forward.
Judging from the "spider" APIs which are still seen in your code
block, you
must not have run the Regular Expression API mapping tool which
will take
care of many of this code. I believe that the API mapper will
migrate this
block of code almost 100% and you just need to uncomment it.
matt
-----Original Message-----
From: njdoe123 [mailto:<a href="/group/SunONE-JATO/post?protectID=230176091112175091130232203140129208071">first.us@a...</a>]
Sent: Thursday, December 20, 2001 4:04 PM
Subject: [iPlanet-JATO] Re: CSpMultiSQL after migration
Oops !
The following (very simple) customized code was not migrated.
In business logic - after update, goto another page.
My backend database is Oracle.
Thanks.
Alex Lin
-------------------------+
// The following code block was migrated from the Update_onWebEvent
method
// MigrationToDo : THIS CODE MUST BE MANUALLY ADJUSTED
int command = PROCEED;
CSpPage nextPage =(CSpPage) CSpider.getPage("PgDistrict");
executeAllUpdatingDataObjects();
return nextPage.load();
--- In iPlanet-JATO@y..., "Craig V. Conover" <craig.conover@s...>
wrote:
Alex,
CSpMultiSQL migrate just fine. You may have had to do something
extraordinary for your
particular database in your select statement.
Can we see the entire exception stack trace, and the code that is
executing the model?
Also, what database are you hitting?
c
njdoe123 wrote:
Hi,
It's a bit strange while doing CSpMultiSQL (select and update).
I have received the following error on the AppServer.
Web event invoked: Test3App.Test3.PgWebUserViewBean.Update
<Dec 19, 2001 2:20:05 PM PST> <Error> <HTTP>
<[WebAppServletContext(168087,Test3
AppWar,/Test3AppWar)] Root cause of ServletException
com.iplanet.jato.model.ModelControlException
java.sql.SQLException: ORA-00933: SQL command not properly ended
'SQL command not properly ended ?' - i haven't touched the sql
code,
it's just simple select and update to one table.
Could iMT do MultiSQL ? If not, what is the solution after
migration
Thanks,
Alex Lin
For more information about JATO, including download information,
please visit:
http://developer.iplanet.com/tech/appserver/framework/index.jsp
For more information about JATO, including download information,
please
visit:
http://developer.iplanet.com/tech/appserver/framework/index.jsp
For more information about JATO, including download information,
please
visit:
http://developer.iplanet.com/tech/appserver/framework/index.jsp
For more information about JATO, including download information, please visit:
http://developer.iplanet.com/tech/appserver/framework/index.jspThank you - Jin and Todd.
Will try that.
Atul
--- In iPlanet-JATO@y..., Byung Jin Chun <bchun@n...> wrote:
try using kregedit and modify the key for the jvm args, using the -x
parameters for the 1.2 runtime
Jin
-----Original Message-----
From: Todd Fast [mailto:<a href="/group/SunONE-JATO/post?protectID=101233080150035167169232031248066208071048">Todd.Fast@S...</a>]
Sent: Tuesday, February 19, 2002 8:40 PM
Subject: Re: [iPlanet-JATO] Re: OutOfMemoryError
Atul--
Out of curiosity - How do you modify the memory parameters for
the container's VM ?? I know I should try to do some research but
figured you may already have some insight and willingness to
share.
Please consider this as low priority.It differs by container; I don't remember details of any particular one.
>
Todd
For more information about JATO, including download information, please
visit:
http://developer.iplanet.com/tech/appserver/framework/index.jsp
<http://developer.iplanet.com/tech/appserver/framework/index.jsp>
[Non-text portions of this message have been removed] -
Example.
One of the columns in my interactive report is labelled Notes.
The data in the column looks like
I really
enjoy
typing up
notes,
please
disregard
Is there any way to get this note all on one line - or atleast expand the width to increase or decrease the number of characters per line.
So either
I really enjoy typing up notes, please disregard
Or
I really enjoy typing up notes,
please disregard
Thanks in advance.Hi Mikez,
You can also consider to render your "Notes"-column as a textarea, eg:
http://apex.oracle.com/pls/apex/f?p=vincentdeelen:23:
For the text area you can define the default number of rows and column width you want. You render a column as text area with an apex_item function:
select apex_item.textarea(3,NOTES,1,80) from MY_TABLE
Where 3 is the index number that you want your NOTES colum to have and 1 and 80 stand for row and column width respectively. When you use apex_item for a column, make sure to set that column as "Standard Report Column" under "Report Attributes".
More info on apex_item:
Oracle Application Express APIs
Regards,
Vincent Deelen
Maybe you are looking for
-
IPhoto 6.0.5 opening at start-up
iPhoto 6.0.5 consistantly opens on start-up. The card-reader is not connected. How do I stop the application from launching? Is this a bug or normal responce? Thanks for any help. G4 Mac OS X (10.4.7) Updated processor 1Ghz, Video and Audio cards
-
Images in mail and safari aren't working.
Some images aren't displaying in mail and safari. Jpg's don't seem to be working, but most gifs are (with a few exceptions). As far as I'm aware no one who uses the computer has changed anything which, as far as I can think, would have any effect on
-
Time Zone issue with 7.0 and DB2
Hi, We are having a time zone issue with weblogic server 7.0 and DB2 database. I would really appreciate if somebody provides a solution for this issue. Our db2 DB is located in PST time zone and weblogic server is located in EST time zone. When we a
-
I am a slight noob, and I cant seem to get this right, i need to have some scrolling text on various parts of a site and an image/ text slider for a company I'm working with. I am having trouble with the following when putting in multiple edge docume
-
Unable to generate WSDL file in quality server in SOAMANAGER
Hi Experts, I have developed a webservice in DEV and generated the wsdl file in soamanager and it works fine. Now when i transport it to QAS webservice gets transported ( SE80 i can see it ) and in soamanager when i go to generate the wsdl file