Regular expression on form value
I have a form value that I need to add a regular expression to the end so I can pick up any characters after the form value.
Example if someone enters Jones then I want to make sure the value could also search Jones Jr or Jones Sr.
Basically add a space and any characters a-z to the form value.
Here is my attempt but lost on regular expression part:
REReplace ("form.myvalue","[[:space:]]","Not sure what the regular expression would be here?","ALL")
This will replace "Jones Jr" and "Jones Sr" in the following text:
"this is a test text Jones Jr and Jones Sr"
ReReplaceNoCase("your_text_in_which_you_want_to_replace",
"#form.myvalue#[[:space:]][a-z]*", "replacement_text", "ALL")
Mack
Similar Messages
-
Regular expression to extract value from xml
Hi,
I need to extract the value of an XML tag.
<purchaseId>Best-200423</purchaseId>
The result of the expression should be: "Best-200423".
Something like this ([^\\<purchaseId\\>]*[^\\</purchaseId\\>]) does not work.
Does somebody has a soltuion?
I can't get it to work! I want to use the Java Regular Expression functionality.
Best wishes
JochenYou got lucky, is all. Try changing "Best" to "pest" in your example and it won't work. The square brackets are spurious, and you want m.getGroup(1) to get the stuff that matches the () group.
Square brackes mean "match any of the characters in the brackets". [^ means "match any character not in this list"). -
Regular expression for numeric values
Hi:
Due to limitations within our environment, I have to use text fields to enter in numeric data only. The client would need to be prompted upon entering a letter that this field excepts only numeric characters.
I am using the code below on the change event for the field and it works fine except that the client can not enter decimals or commas. Does anyone know how to escape the period and commas with this expression?
if (xfa.event.change.match(/[0-9\-]/) == null)
xfa.event.change = "";
xfa.host.messageBox("Only numbers are permitted for this field.");Hi,
This script in the change event will give the warning. I am just thinking if script could also delete the offending character:
var vPattern = /[a-z]/;
var result = vPattern.test(xfa.event.newText);
if (result == true)
xfa.host.messageBox("Only numbers are permitted for this field.");
Good luck,
Niall -
Regular expression not working for adobe forms
Hi,
Iam using qtp for adobe forms and for some reason if i put in regular expression for apid value it doesn't recognise the object..there is nothing wrong with the regular expression as it is evaluated using regular expression evaluator in qtp 11.0....any ideas
I got all the addins and everything and when i used regular expression for the top window it works but for any other object it doesn'tPlease try the code and see the problem. The regular expression is fine.
I can replace the string with these and got results like this:
import java.util.regex.Pattern;
public class HtmlFilter implements TextFilter {
private static String strTagPattern = "<\\s?(.|\n)*?\\s?>";
private static int patternMode = Pattern.MULTILINE | Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE | Pattern.CANON_EQ;
private static Pattern tagPattern = Pattern.compile(strTagPattern, patternMode);
public String filter(String t) {
if(t==null || t.length()==0) return "";
String ret = null;
return tagPattern.matcher(t).replaceAll("");
public static void main(String[] args) {
System.out.println(new HtmlFilter().filter(null));
System.out.println(new HtmlFilter().filter(""));
System.out.println(new HtmlFilter().filter("<P>abc def</P>"));
System.out.println(new HtmlFilter().filter("<P>我国石油供应安全系统影响</P>"));
}The results are
abc def
???????????? -
UTF-8 Regular Expression Whitelist
I'm trying to create a whitelist regular expression for form
input.
<cfset pattern_name = "^[\w]+[\w-\.,\s'""]*$"> works
for Ascii, but I need to include characters 192-255 in the ISO
8859-1 character set.
<cfset pattern_name =
"^[\wÀ-ÿ]+[\wÀ-ÿ-\.,\s'""]*$">
doesn't work. Österström, Garzón, and
Márquez are all rejected.
Does anyone know how to fix it?I'm trying to create a whitelist regular expression for form
input.
<cfset pattern_name = "^[\w]+[\w-\.,\s'""]*$"> works
for Ascii, but I need to include characters 192-255 in the ISO
8859-1 character set.
<cfset pattern_name =
"^[\wÀ-ÿ]+[\wÀ-ÿ-\.,\s'""]*$">
doesn't work. Österström, Garzón, and
Márquez are all rejected.
Does anyone know how to fix it? -
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"
} -
Regular expression check in form
Hi All,
I am trying to plugin Regular expression check on the user form, for different fields. Can I do it in a java file and call this java class file in the validation part? if yes how can i do it if no what are the other alternatives?
Thanks in advanceI did the following using Xpress and a regular expression "if (/\D/.test(Val))" in JavaScript to check for non-numeric characters in a field.
<Field name=':variables.approvalSAPID'>
<Display class='Text'>
<Property name='title' value='SAP ID of Approving Manager'/>
<Property name='required'>
<Boolean>true</Boolean>
</Property>
<Property name='maxLength' value='8'/>
<Property name='size' value='8'/>
<Property name='help' value='SAP ID of the person who is being asked to approve request'/>
</Display>
<Validation>
<cond>
<and>
<eq>
<length>
<ref>:variables.approvalSAPID</ref>
</length>
<i>8</i>
</eq>
<script>
var Val = env.get(':variables.approvalSAPID');
testMe(Val);
function testMe (Val) {
if (/\D/.test(Val))
return (false);
else
return (true);
</script>
</and>
<null/>
<s>! The SAP ID of the Approving Manager must be an 8 digit number !</s>
</cond>
</Validation>
</Field>
Larry L. Viars
Sr. Systems Programmer
Enterprise Systems Management
CenterPoint Energy LLC. -
How to form a regular expression for matching the xml tag?
hi i wanted to find the and match the xml tag for that i required to write the regex.
for exmple i have a string[] str={"<data>abc</data>"};
i want this string has to be splitted like this <data>, abc and </data>. so that i can read the splitted string value.
the above is for a small excercise but the tagname and value can be of combination of chars/digits/spl symbols like wise.
so please help me to write the regular expression for the above requirementyour suggestion is most appreciable if u can give the startup like how to do this. which parser is to be used and stuff like that
-
Validate form entries: does java support regular expressions?
i want to validate form entries, does java support regular express like javascript?
Just recently in 1.4 regex was finally introduced :)
Take a look at http://developer.java.sun.com/developer/technicalArticles/releases/1.4regex/ -
Extract values with Regular Expression
How to extract values into [ ] using regular expression.
With data As
Select 'AAAAAA[10] AAA: 19C' Txt From Dual Union all
Select 'XX[450]-10A' Txt From Dual Union all
Select '[5]AVC19C' Txt From Dual Union all
Select 'FVD[120]D2AC' Txt From Dual
)I hope this return
10
450
5
120Thanks in advanceduser11118871 wrote:
Thanks for all.
Hi BluShadow, can you explain what this is doing!?
ThanksSure.
Search for ----------------| /------- Replace the found pattern in the search string with backreference 1
/------------\ /\ (the first thing backreferenced in the search string)
regexp_replace(txt, '^.*\[(.*)\].*$','\1')
|\/\/\--/\/\/|
| \ \ / \ \|
| | | | | |\- End of string
| | | | | |
| | | | | \- Any number of characters
| | | | |
| | | | \- Right square bracket (escaped)
| | | |
| | | \- any characters (backreferenced by round brackets)
| | |
| | \- Left square bracket (escaped)
| |
| \- Any number of characters
|
\- Start of stringEdited by: BluShadow on Jun 29, 2009 2:19 PM -
Generating values using Regular Expression
Can values be generated using Regular Expreession?
I want to generate unique string values on the fly using secified Regular Expression.
Thanx in advance.
Message was edited by:
Kaustubhi do not know if there is something that can do it automatically but let's say you have the following regex:
"a number of 5 digits" then "2 letters" then "a hyphen" and then "a digit"
what you can do is something like that:
define the vars that will allows you to pick a value for each part of the generated value
this means you will have:
final int[] DIGITS = new int[]{0;1;2;3;4;5;6;7;8;9};
final char[] LETTERS = new char[]{'a', 'b', ... 'z'};
final char HYPHEN = '-';
once you have those vars, all you have to do is to use "Random" class to retrieve a random value from DIGITS and LETTERS
append them all in the correct order , without forgetting to append the HYPHEN and you have your value -
Regular expression to check a value if it contains a specific word.
Hi All,
How can i check if a certain word exists in a value in regular expression ?
I have an attribute called Race. Race can contain the following:
White, Non-Hispanic
Black, Non-Hispanic
White, Non Hispanic
Black, Non Hispanic
White, NonHispanic
Non-Hispanic, white
Non Hispanic - black
What i want is to check if my value contains the word "NON" (NON can be at the beginning, middle or end), if it does, parse it and return it.
This is what I have, however I want to make sure it covers all cases and not missing anything else
select REGEXP_SUBSTR(UPPER(trim('Black, Non-Hispanic')), '[NON]+') from dual;Thanks in advance.Rooney wrote:
Could you please explain what are the 2 ones's for ?The two 1 are not really needed for this. It is just taht the syntax requires those parameters when I add the fifth parameter.
http://docs.oracle.com/cd/E14072_01/server.112/e10592/functions148.htm
First 1 is where the search starts (same as in substr('Abc',1))
Second 1 is the number of occurences. Here meaning return the first occurence that was found. Replace it with 2 in my next example to see a (very slight) difference.
Also 'NON' alone will not cover all cases ?But you don't have non alone. You have regexp with non + upper. The 'i' replaces the upper. Also the output is slightly different. the 'i' version will return the same capitalization as it was found in the original. It depends a little what you want to achieve. And of cause INSTR will give the same info as your version. if the result is > 0 it means NON was found.
with testdata as (select 'White,Non-Hispanic' str from dual union all
select 'Non-White,nOn-Hispanic' str from dual union all
select 'White,Hispanic' str from dual
/* end of test data creation */
select str,
REGEXP_SUBSTR(UPPER(TRIM(str)), 'NON') regexp1,
REGEXP_SUBSTR(str, 'NON',1,1,'i') regexp2,
instr(upper(str),'NON') instr
from testdata;
STR REGEXP1 REGEXP2 INSTR
White,Non-Hispanic NON Non 7
Non-White,Non-Hispanic NON Non 1
White,Hispanic 0 -
Regular expression form validation
I have a form field that I currently validate using
<cfinput pattern="^([a-zA-Z]{2}$" validate="regular_expression"
Type="text" required="yes"> (other attributes also including
name, etc). Anyway, this validates that the input must be 2
letters, but know I need to validate the field so that "NA" is
allowed. Is there a way to do that?The regular expression
[^NA]
causes NA to be escaped.
The expression
[NA]
causes NA to NOT be escaped.
So if I read your code right, you should insert a [^NA] but
if this fails, do the other = [NA]
I always need to test these things :-)
Hope this helps,
Hans -
Regular Expression Search in Forms Builder
Hi everyone, can anyone help me out?
I'm working on a legacy forms migration project (3 to 10g) where item references often do not include the block name.
eg.
:stock_level := :default_level;
instead of
:stk.stock_level := :ctrl.default_level;
There are also instances of set_item_property('stock_level',....)
In complex multi-block forms this obviously makes the form difficult to understand.
Is there a way in which I can search the triggers and program units of a form for items that don't have a block prefix? The Forms search and replace function has a Regular Expression feature, but I have no experience in this area.
I assume I'm looking for something like this:- ":", followed by a character string that doesn't contain a "." or "="
ThanksYou might have a look at the commercial product formsAPIMaster, it has the ability to do such searches (and also automatic replacements, if needed)
-
Problem forming regular expression
Hi,
I want to use regular expression to match a repeating pattern until it meets a particular character. Eg.
The string I am trying to match is a function definition.
function abc()
This is the pattern I am using to match the above string.
Pattern p =
Pattern.compile("function abc.*\r*\n*\\{(\r*\n*.*)*(\r\n)*\\}", Pattern.MULTILINE);
"function abc" takes care of the method signature
" .*\r*\n*\\{" takes care of all spaces/characters/newline till it encounters the opnening brace
"(\r*\n*.*)*" this iswhere the problem lies. This matches all the individual new lines in the method body. But I dont want it to match the closing brace "}" . It is doing that currently. How can I avoid that? So that the next part of the pattern i.e. "\\}" actually matches the closing brace?DrLaszloJamf wrote:
Isn't the basic difference between regular grammars and context free grammars? The latter can generate matched parens, the former can't?I guess you mean by "regular grammar" a "regular language" (forgive my ignorance if they are the same)? But yes, AFAIK that is a difference. However, there are regex engines that can cope with these recursive matches (an undefined number of back references). Perl is one of them.
It is an often heard complaint about implementations of regular expression engines: they have grown too big for what they were created for.
Maybe you are looking for
-
Hi This Ravi Shankar I have already created the Reciever Agreement but when i am configure the Reciever Determination in "Configure Overview for Reciever Determination" tab its showing that Reciever Agreement(Communication Channel) "Does Not Exist" H
-
Solman 7.1 dual stack homogenous System copy
Hi all, I need to perform a solman 7.1 dual stack system copy from QA to sandbox system. Can anybody let me know the steps involved in solman 7.1 dual stack system copy Procedure. Thanks Vimal
-
Oracle Text:Problems in starting
hi all i am working on Oracle 10g in windows and i want to do Text Mining,but i am having some problems.when i use the JDeveloper and start the text wizard it createa a jsp file but it is not loading properly.is there any document from which i can le
-
Dear All Getting All Oracle Instances SIDs How can we get It Thanx In advance
-
I'm fed up of being fobbed off
When we first got BT infinity it was great no problems no issues. After a few months speed dropped, connection dropped intermittently. We phoned they sent new hub, it was fine. Then we started with devices disconnecting. Phoned BT again and was told