IR filter using "matches regular expression"
Hi,
I am familiar with Perl regular expressions, but I'm having trouble using the IR filter by regular expression in Apex.
For instance, I would like to search for dates of format 'MM/DD/YY' - can someone tell me how this would be done? I tried '[0-9](2)/[0-9](2)/[0-9](2)' and many other patterns to no avail.
Also can you point me to a good thread for regular expressions in Apex?
Thanks for any help.
Hi,
you can play around with oracle regular expressions at
http://www.yocoya.com/apex/f?p=YOCOYA:REGEXP_HOME:0:
It's an Apex application, albeit "seasoned", where you can build and test the regex and it will be 100% compatible as it runs natively, so it's not simulated on a different platform.
Most likely the IR filter will make use of REGEXP_LIKE so you can pick that function from the menu.
Flavio
http://oraclequirks.blogspot.com
http://www.yocoya.com
Similar Messages
-
Match Regular Expression does not match what Match Pattern does
I have read through a lot of posts about how Match Pattern does not match what Match Regular Expression will due to not processing some characters.
However, I found a problem with the other way. A simple Reg-Ex that works in Match Pattern but not Match Regular Expression.
What I have here is just an example. I want to use Match Regular Expression so I can specify some sub-matches.
The reg-ex is for: one or more non-numeric characters, a space, one or more numeric characters. At the start of the string.
How can I get this working in Match Regular Expression? I am working in LabVIEW 2010f2 32 bit. Here is the code snippet and the results:
Rob
Solved!
Go to Solution.Robert Cole wrote:
I think I prefer the ~ for negation since ^ is also used for beginning of the string. But we work with what we have.
Let me offer you a tip and perhaps defend the honor of the regex a little bit. One of my favorite features of regexes is the ability to specify character classes (and their negation). One of the reasons I have to think about the ~ versus ^ is that I rarely use ^ in a regex alternative.
Some examples:
[0-9] = \d (digit)
[^0-9] = \D (not a digit)
The equivalent regex for your case is: \D+ \d+ -
Multi-line String - Match Regular Expression
I am trying to figure out the format of a regular expression in order to pull select lines out of a multi-line string and populate those lines as individual elements of a string array while using Match Regular Expression. The overall length of the multi-line string can vary as well as the text contained within the string. The string can contain letters, numbers, and special characters. I have attached an example VI. Within the example VI I only want to return the lines beginning with "Device #" into the array. The number of lines beginning with "Device #" can vary but I want to capture them all.
Or is there a better function to use instead of Match Regular Expression that will give me the desired outcome?
Solved!
Go to Solution.
Attachments:
MultiLine Regular Expression.vi 22 KBaaronb wrote:
I am trying to figure out the format of a regular expression in order to pull select lines out of a multi-line string and populate those lines as individual elements of a string array while using Match Regular Expression. The overall length of the multi-line string can vary as well as the text contained within the string. The string can contain letters, numbers, and special characters. I have attached an example VI. Within the example VI I only want to return the lines beginning with "Device #" into the array. The number of lines beginning with "Device #" can vary but I want to capture them all.
Or is there a better function to use instead of Match Regular Expression that will give me the desired outcome?
Match Regular Expression works well for this.
Ben64 -
Match Regular Expression Function input string format
Hi,
I am new to labview and was having some difficulties using the Match Regular Experssion Function.
I am using labview to communicate with a sensor. I have installed the NI device driver to do so. The output of my sensor is in the format,
X20
R40 P20 A123. The numbers in this case are arbitrary. I am trying to use Match Regular Expression Function to display and perform mathematical operations on the numbers. I am having difficulties formatting the input string on the Match Regular Expression Function. Could you please give me some tips on how to format the example I provided.
ThankMoAgha wrote:
Hi,
I am new to labview and was having some difficulties using the Match Regular Experssion Function.
I am using labview to communicate with a sensor. I have installed the NI device driver to do so. The output of my sensor is in the format,
X20
R40 P20 A123. The numbers in this case are arbitrary. I am trying to use Match Regular Expression Function to display and perform mathematical operations on the numbers. I am having difficulties formatting the input string on the Match Regular Expression Function. Could you please give me some tips on how to format the example I provided.
Thank
Here is a way to do it if the format is constant (X R P A followed by a positive integer number).
Ben64 -
Matching Regular Expressions in OBPM 10GR3
Hi all,
How do I match Regular expressions like" Wait For Response" in Strings using OBPM?
Any idea?
Is there any exact syntax?
Because I tried doing this:-
for( int i=0; i < testGroup.length(); i++)
if(testGroup.reason.match(regexp : "Wait For Response"))
logMessage("--Test Group Matched--");
But it does not work..
Any idea?String myVar = "has matching_char_set";
if ( myVar.match(regexp : '/matching_char_set/') ) {
logMessage("matched...yep");
Try like this ..should work.
Rgds,
Biltu -
Track the entered answer using the Regular expression
Hi,
I am building a Q&A application which does have user to answer descriptive answer for the question(Text based answer rather than objective)
in this case how we can track the entered answer by the user is the correct one? how we can capture the entered answer and then check with the correct
answer in the DB? Yes we need to use a regular expression , but how we know that entered one is matching with the one in the DB
as the user can answer in lengthy or short form ? Hence please clarify how we can proceed?
Thanks.797836 wrote:
Hi,
I am building a Q&A application which does have user to answer descriptive answer for the question(Text based answer rather than objective)
in this case how we can track the entered answer by the user is the correct one? how we can capture the entered answer and then check with the correct
answer in the DB? Yes we need to use a regular expression , but how we know that entered one is matching with the one in the DB
as the user can answer in lengthy or short form ? Hence please clarify how we can proceed?
I don't see how regular expressions help at all with this problem ! What made you think they can help? -
"Match Regular Expression" and "Match Pattern" vi's behave differently
Hi,
I have a simple string matching need and by experimenting found that the "Match Regular Expression" and "Match Pattern" vi's behave somewhat differently. I'd assume that the regular expression inputs on both would behave the same. A difference I've discovered is that the "|" character (the "vertical bar" character, commonly used as an "or" operator) is recognized as such in the Match Regular Expression vi, but not in the Match Pattern vi (where it is taken literally). Furthermore, I cannot find any documentation in Help (on-line or in LabVIEW) about the "|" character usage in regular expressions. Is this documented anywhere?
For example, suppose I want to match any of the following 4 words: "The" or "quick" or "brown" or "fox". The regular expression "The|quick|brown|fox" (without the quotes) works for the Match Regular Expression vi but not the Match Pattern vi. Below is a picture of the block diagram and the front panel results:
The Help says that the Match Regular Expression vi performs somewhat slower than the Match Pattern vi, so I started with the latter. But since it doesn't work for me, I'll use the former. But does anyone have any idea of the speed difference? I'd assume it is negligible in such a simple example.
Thanks!
Solved!
Go to Solution.Yep-
You hit a point that's frustrated me a time or two as well (and incidentally, caused some hair-pulling that I can ill afford)
The hint is in the help file:
for Match regular expression "The Match Regular Expression function gives you more options for matching
strings but performs more slowly than the Match Pattern function....Use regular
expressions in this function to refine searches....
Characters to Find
Regular Expression
VOLTS
VOLTS
A plus sign or a minus sign
[+-]
A sequence of one or more digits
[0-9]+
Zero or more spaces
\s* or * (that is, a space followed by an asterisk)
One or more spaces, tabs, new lines, or carriage returns
[\t \r \n \s]+
One or more characters other than digits
[^0-9]+
The word Level only if it
appears at the beginning of the string
^Level
The word Volts only if it
appears at the end of the string
Volts$
The longest string within parentheses
The first string within parentheses but not containing any
parentheses within it
\([^()]*\)
A left bracket
A right bracket
cat, cag, cot, cog, dat, dag, dot, and dag
[cd][ao][tg]
cat or dog
cat|dog
dog, cat
dog, cat cat dog,cat
cat cat dog, and so on
((cat )*dog)
One or more of the letter a
followed by a space and the same number of the letter a, that is, a a, aa aa, aaa aaa, and so
on
(a+) \1
For Match Pattern "This function is similar to the Search and Replace
Pattern VI. The Match Pattern function gives you fewer options for matching
strings but performs more quickly than the Match Regular Expression
function. For example, the Match Pattern function does not support the
parenthesis or vertical bar (|) characters.
Characters to Find
Regular Expression
VOLTS
VOLTS
All uppercase and lowercase versions of volts, that is, VOLTS, Volts, volts, and so on
[Vv][Oo][Ll][Tt][Ss]
A space, a plus sign, or a minus sign
[+-]
A sequence of one or more digits
[0-9]+
Zero or more spaces
\s* or * (that is, a space followed by an asterisk)
One or more spaces, tabs, new lines, or carriage returns
[\t \r \n \s]+
One or more characters other than digits
[~0-9]+
The word Level only if it begins
at the offset position in the string
^Level
The word Volts only if it
appears at the end of the string
Volts$
The longest string within parentheses
The longest string within parentheses but not containing any
parentheses within it
([~()]*)
A left bracket
A right bracket
cat, dog, cot, dot, cog, and so on.
[cd][ao][tg]
Frustrating- but still managable.
Jeff -
Question about match regular expression
Colleagues,
Very stupid question. I would like to get substring between "..." symbols. For example, string 02 July from Explosion occurred on "02 July", 2008.
How to do this with single Match Regular Expression?
For example such expression ".*" will give me "02 July":
But I would like to get it without " symbols!
I tried this "[~"]*" and this "[~"].*", then read this and this , and all without success... But I'm sure it should be possible. Can you help me?
Andrey.
PS
This regular expression should give exactly the same output as following construction:I'm only using 7.0 now, but you can do this with Scan from String...
%[^"]"%[^"]"%[^"]
Message Edited by Phillip Brooks on 07-02-2008 02:47 PM
Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
If you don't hate time zones, you're not a real programmer.
"You are what you don't automate"
Inplaceness is synonymous with insidiousness
Attachments:
NotPCRE.png 20 KB -
Parse Mac Address with match regular expression
Hi Everyone,
I have a problem with the Match Regular Expression function,
I am trying to parse the response two a arp -a 192.168.0.15 request in order to extract MAC address of this remote IP, I used the following RegEx: ^([0-9a-fA-F]{2}[:-]){5}([0-9a-fA-F]{2})$
I am wondering why do I need to do a string subset first to extract only the MAC Address part. Isn't Match Regular Expression function capable of recognizing the RegEx directly in the middle of a string?
I only works when I extract the right tring subset as in the picture bellow.
Thanks for your answers.
Solved!
Go to Solution.
Attachments:
Mac Address.JPG 40 KBGet rid of the "^" in the beginning of your regular expression. You are instructing it to find the pattern at the beginning of the string.
Mark Yedinak
"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot -
Match Regular Expression not returning submatches.
I am having an issue with Match Regular Expression not returning the appropriate number of submatches. My string is as follows:
DATAM 995000 1.75 0.007 -67.47 24.493 99.072
The spaces are tabs and the length is not fixed so simple string manipulation is out of the question. The regular expression I was trying is as follows:
(?<=\t)[0-9\.\-]*(?=(\t|$))
It successfully returns Whole Match as the first number but no submatches are returned. I've tried simpler expressions which work in Matlab and EditPad Pro such as [0-9.-]* but never got the same answer in Labview.
What is going on?Here is an image of the VI. The top portion is the input from our Licor 7000. The bottom portion is the bit of code I'm having problems with.
Attachments:
matchregularexpression.jpg 336 KB -
Use a regular expression to do this...
I need to process this line : "STRTsomeEND.STRTsome2END.STRTsome3END"
to get an array with this values :
String[] processedLine = {
{"STRTsomeEND."}
{"STRTsome2END."}
{"STRTsome3END."}
I tried to use this regular expression to do the work: (STRT[.*]END.)+ but doesn't work. Also I tried with this expresion STRT[.*]END. But I only got the first ocurrence ("STRTsomeEND") .
Can anybody help me?zkropotkine wrote:
1) "." is a regex flag.I saw in the table and it said that the "." symbol doesn't need the escape: )
when you ask a question and then someone gives you advice you should
give them the benefit of the doubt (for at least a little while).
did you take a moment to try to understand what i was saying about escaping the "."?
anyway, your regex should be:
(START)(.*?)(END)\ \ .
the "?" after the "\*" means "reluctant". you dont want the ".\*" to grab up everything.
with the reluctant modifier "?" the regex should stop and grab the first available "END".
and finally, if you meant the "." at the end of "STARTsomethingEND." literally then:
you need to escape the "." -
Pattern matching regular expressions
I'm attempting to determine if a string matches a pattern of containing less than 100 alphanumeric characters a-z or 0-9 case insensitive. So my regular expression string looks like:
"^[a-zA-Z0-9]{0,100}$"And I use something like...
Pattern pattern = Pattern.compile( regexString );I'd like to modify my regex string to include the email 'at' symbol "@". So that the at symbol will be allowed. But my understanding of regex is very limited. How do I include an "or at symbol" in my regex expression?
Thanks for your help.* Code by sabre150
private static final Pattern emailMatcher;
static
// Build up the regular expression according to RFC821
// http://www.ietf.org/rfc/rfc0821.txt
// <x> ::= any one of the 128 ASCII characters (no exceptions)
String x_ = "\u0000-\u007f";
// <special> ::= "<" | ">" | "(" | ")" | "[" | "]" | "\" | "."
// | "," | ";" | ":" | "@" """ | the control
// characters (ASCII codes 0 through 31 inclusive and
// 127)
String special_ = "<>()\\[\\]\\\\\\.,;:@\"\u0000-\u001f\u007f";
// <c> ::= any one of the 128 ASCII characters, but not any
// <special> or <SP>
String c_ = "[" + x_ + "&&" + "[^" + special_ + "]&&[^ ]]";
// <char> ::= <c> | "\" <x>
String char_ = "(?:" + c_ + "|\\\\[" + x_ + "])";
// <string> ::= <char> | <char> <string>
String string_ = char_ + "+";
// <dot-string> ::= <string> | <string> "." <dot-string>
String dot_string_ = string_ + "(?:\\." + string_ + ")*";
// <q> ::= any one of the 128 ASCII characters except <CR>,
// <LF>, quote ("), or backslash (\)
String q_ = "["+x_+"$$[^\r\n\"\\\\]]";
// <qtext> ::= "\" <x> | "\" <x> <qtext> | <q> | <q> <qtext>
String qtext_ = "(?:\\\\[" + x_ + "]|" + q_ + ")+";
// <quoted-string> ::= """ <qtext> """
String quoted_string_ = "\"" + qtext_ + "\"";
// <local-part> ::= <dot-string> | <quoted-string>
String local_part_ = "(?:(?:" + dot_string_ + ")|(?:" + quoted_string_ + "))";
// <a> ::= any one of the 52 alphabetic characters A through Z
// in upper case and a through z in lower case
String a_ = "[a-zA-Z]";
// <d> ::= any one of the ten digits 0 through 9
String d_ = "[0-9]";
// <let-dig> ::= <a> | <d>
String let_dig_ = "[" + a_ + d_ + "]";
// <let-dig-hyp> ::= <a> | <d> | "-"
String let_dig_hyp_ = "[-" + a_ + d_ + "]";
// <ldh-str> ::= <let-dig-hyp> | <let-dig-hyp> <ldh-str>
// String ldh_str_ = let_dig_hyp_ + "+";
// RFC821 looks wrong since the production "<name> ::= <a> <ldh-str> <let-dig>"
// forces a name to have at least 3 characters and country codes such as
// uk,ca etc would be illegal! I shall change this to make the
// second term of <name> optional by make a zero length ldh-str allowable.
String ldh_str_ = let_dig_hyp_ + "*";
// <name> ::= <a> <ldh-str> <let-dig>
String name_ = "(?:" + a_ + ldh_str_ + let_dig_ + ")";
// <number> ::= <d> | <d> <number>
String number_ = d_ + "+";
// <snum> ::= one, two, or three digits representing a decimal
// integer value in the range 0 through 255
String snum_ = "(?:[01]?[0-9]{2}|2[0-4][0-9]|25[0-5])";
// <dotnum> ::= <snum> "." <snum> "." <snum> "." <snum>
String dotnum_ = snum_ + "(?:\\." + snum_ + "){3}"; // + Dotted quad
// <element> ::= <name> | "#" <number> | "[" <dotnum> "]"
String element_ = "(?:" + name_ + "|#" + number_ + "|\\[" + dotnum_ + "\\])";
// <domain> ::= <element> | <element> "." <domain>
String domain_ = element_ + "(?:\\." + element_ + ")*";
// <mailbox> ::= <local-part> "@" <domain>
String mailbox_ = local_part_ + "@" + domain_;
emailMatcher = Pattern.compile(mailbox_);
System.out.println("Email address regex = " + emailMatcher);
}Wow. Sheesh, sabre150 that's pretty impressive. I like it for two reasons. First it avoids some false negatives that I would have gotten using the regex I mentioned. Like, [email protected] is a valid email address which my regex pattern has rejected and yours accepts. It's unusual but it's valid. And second I like the way you have compartmentalized each rule so that changes, if any custom changes are desired, are easier to make. Like if I want to specifically aim for a particular domain for whatever reason. And you've commented it so that it is easier to read, for someone like myself who knows almost nothing about regex.
Thanks, Good stuff! -
Match Regular Expression Function
Hi guys, using this pattern I got this error:
-4600 Error occurred during regular expression match.
I have attached the VI.
can you help me?thank you
Solved!
Go to Solution.
Attachments:
Untitled 2.vi 30 KBinuyasha84 wrote:
hi well i want to save (create) a file and do a check to see if the new file that I want to create already exist or not. so the idea was to see if the path of the new file is equal to the old path
Why not just use "Check if file or folder exists"? (File I/O -> Adv File Funcs)
Cameron
To err is human, but to really foul it up requires a computer.
The optimist believes we are in the best of all possible worlds - the pessimist fears this is true.
Profanity is the one language all programmers know best.
An expert is someone who has made all the possible mistakes.
To learn something about LabVIEW at no extra cost, work the online LabVIEW tutorial(s):
LabVIEW Unit 1 - Getting Started
Learn to Use LabVIEW with MyDAQ -
Use of Regular Expression...
Hi ,
How should i write a reg_exp function returning into 3 variables the parts of the following string...?????
("HIS"."EISAG"."DATE_INPUT")
In other words , i would like in three variables to get the string HIS , EISAG , DATE_INPUT using the Reg_exp function
Thanks , A lot
SimonHi sgalaxy,
Try this.
-- setup
create table t ( c varchar2(30) );
insert into t values ( '("HIS"."EISAG"."DATE_INPUT")' );
insert into t values ( '("ABC"."DEF"."GHI")' );
insert into t values ( '("ABC"."DEF")' );
insert into t values ( '("ABC")' );
insert into t values ( '("".""."")' );
insert into t values ( null );
insert into t values ( 'XYZ' );
set null '(null)'
-- v10 solution
column result_1 format a10
column result_2 format a10
column result_3 format a10
select
2 c,
3 regexp_replace
4 ( regexp_substr( c, '".*?"', 1, 1 ),
5 '"(.*?)"',
6 '\1'
7 ) as result_1,
8 regexp_replace
9 ( regexp_substr( c, '".*?"', 1, 2 ),
10 '"(.*?)"',
11 '\1'
12 ) as result_2,
13 regexp_replace
14 ( regexp_substr( c, '".*?"', 1, 3 ),
15 '"(.*?)"',
16 '\1'
17 ) as result_3
18 from t
19 ;
C RESULT_1 RESULT_2 RESULT_3
("HIS"."EISAG"."DATE_INPUT") HIS EISAG DATE_INPUT
("ABC"."DEF"."GHI") ABC DEF GHI
("ABC"."DEF") ABC DEF (null)
("ABC") ABC (null) (null)
("".""."") (null) (null) (null)
(null) (null) (null) (null)
XYZ (null) (null) (null)
-- cleanup
drop table t;As I recently told another user, if you are interested in learning more about regular expressions I have a tutorial you might find useful at http://www.sqlsnippets.com/en/topic-10759.html .
Message was edited to fix typos. -
$10 for answer: using Pattern - regular expressions and Scanner
I'm trying to read input messages using Scanner. The messages are in format: word1 word2 number. the "number" is followed by "C null terminator" i.e. '\u0000' character.
I tried this:
Scanner input;
Pattern pat = Pattern.compile("(\\w+) (\\w+) (\\d+)\u0000");
input.useDelimiter(pat);
while (input.hasNext(pat)) {
The input is there and in correct format, but it hangs hasNext(pat) - as if input is not correct. What did I do wrong? Thanks in advance - thsi is urgent, I'd be glad to send you $10 for correct answer via PayPal.
Message was edited by:
MrM654Here is a Regex and a Scanner implementation.
The price is $20 because there are 2 ways to do this.
Plus at least a $10 courtesy tip.
import java.util.Scanner;
import java.util.regex.*;
public class RegexTest{
public static void main(String[] args){
new RegexTest();
public RegexTest(){
String input = "word1 word1 1\u0000 word2 word2 2\u0000 word3 word3 3\u0000";
Pattern pattern = Pattern.compile("(\\w+ \\w+ \\d+\\u0000)");
Matcher matcher = pattern.matcher(input);
while(matcher.find() == true){
System.out.println("Match: " + matcher.group());
String input = "word word 1\u0000 word2 word2 2\u0000 word3 word3 3\u0000";
Pattern pattern = Pattern.compile("(\\w+) (\\w+) (\\d+)\\u0000\\s*");
Scanner scanner = new Scanner(input);
String result;
while((result = scanner.findInLine(pattern)) != null){
System.out.println("Match: " + result);
System.out.println("Done.");
}Edit: Changed Pattern to end with \\s* to be insensitive to ending spaces
Maybe you are looking for
-
Search option for inbox in ic webclient
Hi , i am working on crm_ic_inbox_badi . we are not able to filter the call list according to their status. when we select in process call in status we are getting all the calls for in process status and also for open status. well in this badi after
-
BAPI project systems actuals versus planned
Hello, I am looking for a BAPI/Idoc for displaying planned versus actuals similar to report s_alr_87013532. I have looked everywhere but cannot find anything. Also checked in OPENPS if there where any BAPI's for getting the information, but also not.
-
Delta criteria in BW??
Dear All, I am trying to pull a table ZSNPLAN to BW from R/3 by generic extraction. The table contains data on Planned factory delivery report uploaded to r/3 weekly through a program. the fields in the table are : Client Year Month Week
-
I have a QT movie in a media holder, but what I would like to do is this. Dissolve it in, but not play until a second mouse-click. Fade up then down the music, so the ending is not abrupt. Is this possible. Thank you again in advance.
-
Looking for job on Oracle Apps DBA & Sys Admin
Dear any one can tell me the list of oracle apps consultant or the name of the company who are using oracle apps because I am lookin a job as Oracle apps dba & sysadmin in Riyadh( Saudi Arabia). regards