String.matches error
Hi,
this is my code:
if((bib.author.matches("*" + request.bib.author + "*")){
with bib.author and request.bib.author 2 strings which may be similar.
And i use regex to compare themp but i've got this kind of exception:
java.util.regex.PatternSyntaxException: Dangling meta character '*' near index 0
Teddy
^
when request.bib.author = "Teddy"
I don't know what it means, if someone gets an idea, i take it!
thx
SHiSo
* means "take the group before it, I'll match THAT 0 or more times".
so " <space>*" means 0 or more spaces. "<nothing>*" is an error.
dot (.) in regex means "anything", so .* is "match anything
more info
Tutorial
Similar Messages
-
Keep getting "error in loading string XML error is Z and ACP Main Resource DLL failed
Firefox is constantly crashing. When it restarts I get this error messages: "error in loading string XML error is Z and another error message "ACP Main--Resource DLL Failed"
I don't know if these messages are associated with Firefox or something else; however, my response time is just awful with Firefox and it is getting worse!My understanding of exception stack trace is that the two class loader are unable to match the argument type org/springframework/core/io/Resource in original method and its overridden method. And original method class loader and overridden method class loader are different.
This normally happens due to class clashes. -
hi guys,
Can anyone tell me what is the easiest way to find out Report miss match error of bi with r3 report especially in fi.
thanks in advance,
regards,
Bunty.lots of ways we can do that.Check your reconciliation reports at your organistaion , then you will get an idea how they compare each time otherwise in general everybody copies data in excel and want to compare.
-
I need an execution of commands after the reply from the instrument matches with the string I provided for that i used true or false string match VI on which the true string the matching command and the string is the reply from the instrument. And I put the further executionable commands in frame after frame of sequence loop in the true of the case structure. Amd finally I given all the output strings to the concatenate string to get all the replies as one loop. But when I execute the program the desired result is not available. So kindly please help me to overcome this problem.
Attachments:
basic serial with changes.vi 24 KBYou VI makes absolutely no sense and I would recommend you start with a few simple LabVIEW tutorials before trying to tackle this.
What is the point of the FOR loop with 1 iteration, it might as well not even be there, same difference.
Why is there an abort primitive in the FOR loop, this mean the program will unconditionally stop abort before any downstream code will ever go into action. The program will never get past the FOR loop.
You created a circular data dependency and LabVIEW inserted a feedback node automatically, making things even worse. (see also)
You need to learn about dataflow, execution order, and data dependency.
You need to learn about the various types of tunnels (plain, autoindexing, etc.)
There is a tremendous amount of duplicate code. Large code sections are the same, differeing only by a string. You should only have one copy of that code inside a proper state machine. Have a look at the design templates and examples that ship with LabVIEW.
LabVIEW Champion . Do more with less code and in less time . -
Trying to add a database in DBA studio: getting NLNV String format error
I'm trying to add a database in DBA studio, but I'm getting the following error:
Failed to parse tnsnames.ora file
Error: 100 -- NLNV-NLNV String Format Error
Does anyone know what I need to do? Thanks.Anybody see this before? Yes I have several times, but till today I have not found an answer. Someone from Oracle can help us??
Thanks
Chenthil -
An additional question about regular expressions with String.matches
does the String.matches() method match expressions when some substring of the String matches, or does it have to match the entire String? So, if i have the String "123ABC", and i ask to match "1 or more letters" will it fail because there are non-letters in the String, but then pass if i add "1 or more letters AND 1 or more digits"? so, in the latter every character in the String is accounted for in the search, as opposed to the first. Is that correct, or are there ways to JUST match some substring in the String instead of the whole thing? i WILL make some examples too... but does that make sense?
It has to match the whole String. Use Matcher.find() to match on just a sub-string()
-
String.matches vs Pattern and Matcher object
Hi,
I was trying to match some regex using String.matches but for me it is not working (probably I am not using it the way it should be used).
Here is a simple example:
/* This does not work */
String patternStr = "a";
String inputStr = "abc";
if(inputStr.matches( "a" ))
System.out.println("String matched");
/* This works */
Pattern p = Pattern.compile( "a" );
Matcher m = p.matcher( "abc" );
boolean found = false;
while(m.find())
System.out.println("Matched using Pattern and Matcher");
found = true;
if(!found)
System.out.println("Not matching with Pattern and Matcher");
Am I not matches method of String class properly?
Please throw some lights on this.
Thank you.String.matches looks at the whole string.
bsh % "abc".matches("a");
<false>
bsh % "abc".matches("a.*");
<true> -
Still getting itunes match error code 4001
Still getting itunes match error code 4001. Have tried the a/lt/option delete to trick, have reinstalled, etc. Nothing works. Anyone know of a fix?
iTunes Match get error -3231 - https://discussions.apple.com/message/22682187 - read all posts, not just the "solved" one.
-
ALUI Installation Error : error: ResourceManager i18n Strings Loading Error
Hi
I installed ALUI 6.5 .Net version. on Windows XP . The portal diagnostics was successfull. However i still see the error
failure FATAL: ResourceManager i18n Strings Loading Error (.NET)
recommendation RECOMMENDATION: This indicates an installation error, folder access rights issue, corrupt i18n XML files, or incorrect customer implementation of additional language support. Since this is .NET you should first check that the IIS anonymous user has full access to the i18n settings folder. To isolate other causes of this issue, try enabling debug mode in portalconfig.xml (set the DebuggingMode setting to 1) and restarting your portal. This enables the i18n diagnostic unit tests, which should then output more detailed errors to ptspy.
exception XPIOException Problem loading resource file "D:\apps\bea\alui\ptportal\6.5\i18n\\de\ptmsgs_portaladminmsgs.xml": Access to the path 'D:\apps\bea\alui\ptportal\6.5\i18n\de\ptmsgs_portaladminmsgs.xml' is denied.
message Problem loading resource file "D:\apps\bea\alui\ptportal\6.5\i18n\\de\ptmsgs_portaladminmsgs.xml": Access to the path 'D:\apps\bea\alui\ptportal\6.5\i18n\de\ptmsgs_portaladminmsgs.xml' is denied.
secondary exception at com.plumtree.openfoundation.internationalization.XPResourceSet.CreateFileBasedResourceSet(String baseName)
I dont see any problem with the anonymous user access. Tried to reinstall couple of times , but still facing the same error.
Any help, (solution, documentation, links, susggestions) which could help me in resolving the problem is greatly appreciated .
Thank You"I installed ALUI 6.5 .Net version. on Windows XP".
Don't Think ALUI 6.5 is supported on XP. Try installing on a supported platform.
http://edocs.bea.com/en/alui/ali/docs65/AquaLogicInteraction_win_InstallationGuide_6-5/ref_win_softwarerequirements.html
Component :
AquaLogic Interaction Host Machine
Requirement :
Microsoft Windows Server -2003 SP1 or R2, SP2, on x86 , 32–bit only.
Cheers!!! -
String.matches() faulty?
I wondered why my regExp didn't work when I called it with
myString.matches(searchString);So I wrote this test code:
System.out.println("Test: if substring exists:");
String text = "Using org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser as SAX2 Parser";
String search = "as SAX2 Parser";
String regExp = "\\S*("+search.toUpperCase()+"\\S*)";
Pattern pat = Pattern.compile(regExp);
Matcher m = pat.matcher(text.toUpperCase());
while (m.find()) {
System.out.println("found2: "+text.substring(m.start(), m.end()));
System.out.println("Same with String.matches:");
System.out.println("found2: "+text.matches(regExp));and the first custom code matches the regExp and the String.matches() doesn't match. What's the catch?"abc" -> find ("b") -> finds "b"
"abc".matches("b") -> returns false
"b".matches("b") -> returns false
"abc".matches(".b.") > returns trueIf you'd like you could say that matches assumes an
implicit "^" at the beginning and an "$" at the end
of your regex. It tries to match the entire
string and if it doesn't capture it all it returns
false.Why is
"b".matches("b") -> returns false? -
Contains return all the records when the query string matches the columns
I used the multi_column_datastore preference and created an index on three columns (item_name, description,owner_part_number). Now if I do a search:
select * from items where contains(description, 'description') > 0;It returns all the rows in items table, but not all the rows have "description" as a word. I guess Oracle text assumes the query intends to get all the rows as the query string matches one of the column names. My question is whether Oracle Text has any preference settings to alter this behavior?
execute ctx_ddl.create_preference('item_multi_preference', 'MULTI_COLUMN_DATASTORE');
execute ctx_ddl.set_attribute('item_multi_preference', 'columns', 'item_name, description,owner_part_number');
create index item_text_index on items(description) indextype is ctxsys.context filter by owner parameters('LEXER ENG_LEXER WORDLIST ENG_WORDLIST STOPLIST CTXSYS.EMPTY_STOPLIST datastore item_multi_preference MEMORY 1024M');Thanks.
Jun GaoIt looks like a basic_section_group fixes the problem as well, as demonstrated below and I believe a basic_section_group may be more efficient than auto_section_group.
SCOTT@orcl_11gR2> -- recreation of problem:
SCOTT@orcl_11gR2> drop table items
2 /
Table dropped.
SCOTT@orcl_11gR2> create table items (
2 "ITEM_NAME" varchar2(100 byte),
3 "ITEM_NUMBER" varchar2(100 byte),
4 "DESCRIPTION" varchar2(4000 byte),
5 "OWNER" number
6 )
7 /
Table created.
SCOTT@orcl_11gR2> begin
2 FOR Lcntr IN 1..100
3 loop
4 insert into items (item_name, item_number, description, owner)
5 values (dbms_random.string('A', 10),
6 dbms_random.string('A', 10),
7 dbms_random.string('L', 8) || ' '
8 || dbms_random.string('A', 4)
9 || dbms_random.string('A', 5) || ' '
10 || dbms_random.string('A', 10),
11 dbms_random.value(1,10) );
12 end loop;
13 end;
14 /
PL/SQL procedure successfully completed.
SCOTT@orcl_11gR2> begin
2 FOR Lcntr IN 1..100
3 loop
4 insert into items (item_name, item_number, description, owner)
5 values (dbms_random.string('A', 10),
6 dbms_random.string('A', 10),
7 dbms_random.string('L', 8) || ' '
8 || dbms_random.string('A', 4) || '111'
9 || dbms_random.string('A', 5) || ' '
10 || dbms_random.string('A', 10), 1234 );
11 end loop;
12 end;
13 /
PL/SQL procedure successfully completed.
SCOTT@orcl_11gR2> exec ctx_ddl.drop_preference('ENG_WORDLIST');
PL/SQL procedure successfully completed.
SCOTT@orcl_11gR2> begin
2 ctx_ddl.create_preference('ENG_WORDLIST', 'BASIC_WORDLIST');
3 ctx_ddl.set_attribute('ENG_WORDLIST','PREFIX_INDEX','TRUE');
4 ctx_ddl.set_attribute('ENG_WORDLIST','PREFIX_MIN_LENGTH',1);
5 ctx_ddl.set_attribute('ENG_WORDLIST','PREFIX_MAX_LENGTH',10);
6 ctx_ddl.set_attribute('ENG_WORDLIST','SUBSTRING_INDEX','TRUE');
7 ctx_ddl.set_attribute('ENG_WORDLIST','WILDCARD_MAXTERMS', 0);
8 end;
9 /
PL/SQL procedure successfully completed.
SCOTT@orcl_11gR2> execute ctx_ddl.drop_preference('ENG_LEXER');
PL/SQL procedure successfully completed.
SCOTT@orcl_11gR2> begin
2 CTX_DDL.CREATE_PREFERENCE ('ENG_LEXER', 'BASIC_LEXER');
3 CTX_DDL.SET_ATTRIBUTE ('ENG_LEXER', 'PRINTJOINS', '@-_');
4 end;
5 /
PL/SQL procedure successfully completed.
SCOTT@orcl_11gR2> execute ctx_ddl.drop_preference('items_multi_preference');
PL/SQL procedure successfully completed.
SCOTT@orcl_11gR2> begin
2 ctx_ddl.create_preference('items_multi_preference', 'MULTI_COLUMN_DATASTORE');
3 ctx_ddl.set_attribute('items_multi_preference', 'columns', 'item_name, description,item_number');
4 end;
5 /
PL/SQL procedure successfully completed.
SCOTT@orcl_11gR2> create index items_text_index
2 on items(description)
3 indextype is ctxsys.context
4 parameters
5 ('LEXER ENG_LEXER
6 WORDLIST ENG_WORDLIST
7 STOPLIST CTXSYS.EMPTY_STOPLIST
8 datastore items_multi_preference
9 MEMORY 1024M')
10 /
Index created.
SCOTT@orcl_11gR2> create index owner_idx on items (owner)
2 /
Index created.
SCOTT@orcl_11gR2> exec dbms_stats.gather_table_stats (user, 'ITEMS')
PL/SQL procedure successfully completed.
SCOTT@orcl_11gR2> select count(*)
2 from items
3 where contains (description, 'description') > 0
4 /
COUNT(*)
200
1 row selected.
SCOTT@orcl_11gR2> -- correction of problem:
SCOTT@orcl_11gR2> exec ctx_ddl.drop_section_group ('items_sec')
PL/SQL procedure successfully completed.
SCOTT@orcl_11gR2> begin
2 ctx_ddl.create_section_group ('items_sec', 'basic_section_group');
3 ctx_ddl.add_field_section ('items_sec', 'item_name', 'item_name', true);
4 ctx_ddl.add_field_section ('items_sec', 'description', 'description', true);
5 end;
6 /
PL/SQL procedure successfully completed.
SCOTT@orcl_11gR2> drop index items_text_index
2 /
Index dropped.
SCOTT@orcl_11gR2> create index items_text_index
2 on items(description)
3 indextype is ctxsys.context
4 parameters
5 ('LEXER ENG_LEXER
6 WORDLIST ENG_WORDLIST
7 STOPLIST CTXSYS.EMPTY_STOPLIST
8 datastore items_multi_preference
9 MEMORY 1024M
10 section group items_sec')
11 /
Index created.
SCOTT@orcl_11gR2> select count(*)
2 from items
3 where contains (description, 'description') > 0
4 /
COUNT(*)
0
1 row selected. -
Email Regular Expression with a String.Match()
I'm currently using a RichTextEditor for a user to build HTML
for a site. However, I want the application to scan for emails and
encode them so they are protected from spam bots when they go to
the live site. I've written a regular expression to find an email
and it seems to work, but it only returns one email at a time from
the string. I have had to revert to a while loop to traverse the
string until I'm satisfied. I don't particularly like that method
and would like to just do one String.match() query to retrieve all
of the emails. Can anyone see something here that I'm missing?Try adding the global flag (g):
var emailPattern:RegExp =
/[a-z][\w.-]+@\w[\w.-]+\.[\w.-]*[a-z][a-z]+/g;
TS -
Cannot get regular expression to return true in String.matches()
Hi,
My String that I'm attempting to match a regular expression against is: value=='ORIG')
My regular expression is: value=='ORIG'\\) The double backslashes are included as a delimiter for ')' which is a regular expression special character
However, when I call the String.matches() method for this regular expression it returns false. Where am I going wrong?
Thanks.The string doesn't contain what you think it contains, or you made a mistake in your implementation.
public class Bar {
public static void main(final String... args) {
final String s = "value=='ORIG')";
System.out.println(s.matches("value=='ORIG'\\)")); // Prints "true"
} -
String.matches() question - regular expression help
How come the following code's if condition returns false?
String someFile="Dr. Phil.pdf";
if (someFile.matches("[.][Pp][Dd][Ff]$")) {
System.out.println("File is a pdf file.");
}When I change the the matches method to matches(".*[Pp][Dd][Ff]$") it works, so does that mean it has to match the entire string to return true? If so, how can I determine if a partial match occured?
If partial matching isn't feasible, then can someone help me look determine if this is the best matching pattern to use:
matches(".*[.][Pp][Dd][Ff]$")Thanks.The documentation is your friend.
[String.matches(regex)|http://java.sun.com/javase/6/docs/api/java/lang/String.html#matches(java.lang.String)] says:
An invocation of this method of the form str.matches(regex) yields exactly the same result as the expression
Pattern.matches(regex, str)And [Pattern.matches(regex, str)|http://java.sun.com/javase/6/docs/api/java/util/regex/Pattern.html#matches(java.lang.String, java.lang.CharSequence)] says
behaves in exactly the same way as the expression
Pattern.compile(regex).matcher(input).matches()And [Matcher.matches()|http://java.sun.com/javase/6/docs/api/java/util/regex/Matcher.html#matches()] says
Attempts to match the entire region against the pattern. -
The dreaded "sample rates do not match" error: imac
Greetings,
I am getting the "samples rates do not match" error when I try to record in an audio file. I see a lot of stuff online about fixing this on windows, but haven't found the solution for my late 2012 iMac.
I've made the audio file stereo, 24 bit, 48kHz.
I've checked the audio midi setup and both the mic and the speakers are set to 2ch 24 bit 48kHz.
Still get the error....
What am I missing?
Thanks!What audio interface are you using? You need to make that that is set to 48k as well.
Maybe you are looking for
-
I have an Planning Application... When i am Refreshing the Applicaiton to Essbase i got an error " *com.hyperion.planning.olap.EssbaseException: Unable to load database [%s] (1002097)* " .... my essbase is corrupt.... I guess... I could not able to l
-
ITunes will not open - hangs up every time
I am running os x 10.8.5, on a mac book pro 2.4 ghz intel core 2 duo. iTunes will NOT open and run. It starts up, then hangs, nonresponsive, every single time. NOTE - I already reinstalled iTunes, to no avail.
-
Hi I am new to SSAS. Could you please share any links for how to implement incremental processing in cube (Step by Step)
-
Posting periods for futere are opened
By mistake future posting periods are opened by me in MMPV.How to reverse ? What is the way to reverse ?
-
Missing reference org.openxml.parser (HTMLParser & ErrorReport)
I have been tasked with taking an older java program and converting it to utilize JSF. My initial task was to import the existing project into netbeans and make it operational without altering any code. The program is looking for a org.openxml.parser