Validation Regular expression
Hi guys,
How to validate a data type as following
NUMBER(6,4)
Thanks
Siere
Hi Siere
1.) Create a validation on the field, make it a regular expression, and enter in ^\d{6}.\d{4}$2.) Also create a computation at the page level on that field. Make the computation a PL/SQL expression and enter in replace(to_char(:p3_name_of_your_item), ',');3.) If dollars signs might also appear in the number, Make another PL/SQL expression and enter in replace(to_char(:p3_name_of_your_item), '$');This will validate that the numbers must be entered in as 123456.1234 and if they are entered in like $123,456.1234 or 123,456.1234, the commas and dollar signs will be taken out during the computations and changed to 123456.1234
~Andrew Schultz
Similar Messages
-
Field validation regular expression to accept only numbers
Hello.
I would like to have a field validation regular expression to accept only numbers - no characters. The list of pre-packaged regular expressions that are included with ApEx does not contain this and I am not a very good regular expression writer. Can anyone help?
Thanks!
BorisUnder the Regular Expression validation all you need to have is:
^[[:digit:]]$For the email address it just depends how detailed you want it:
^((?>[a-zA-Z\d!#$%&'*+\-/=?^_`{|}~]+\x20*|"((?=[\x01-\x7f])[^"\\]|\\[\x01-\x7f])*"\x20*)*(?<angle><))?((?!\.)(?>\.?[a-zA-Z\d!#$%&'*+\-/=?^_`{|}~]+)+|"((?=[\x01-\x7f])[^"\\]|\\[\x01-\x7f])*")@(((?!-)[a-zA-Z\d\-]+(?<!-)\.)+[a-zA-Z]{2,}|\[(((?(?<!\[)\.)(25[0-5]|2[0-4]\d|[01]?\d?\d)){4}|[a-zA-Z\d\-]*[a-zA-Z\d]:((?=[\x01-\x7f])[^\\\[\]]|\\[\x01-\x7f])+)\])(?(angle)>)$or...
[\w-]+@([\w-]+\.)+[\w-]+Hope these help
Edited by: MikesHotRod on Sep 3, 2008 12:40 PM -
URL validation - regular expression
Hello,
I searched but didn´t find.
I need a simple method: isValidUrl
I tried "new URL(url)", getting error, but it allows a simple url with space... I tried too org.apache.validator but it brought me problems with related .jar...
I got one validation for e-mail, that work very well using regex. Does anyone have URL validation using regular expression?
Thanks.^(http|https|ftp)\\://[a-zA-Z0-9\\-\\.]+\\.[a-zA-Z]{2,3}(:[a-zA-Z0-9]*)?/?([a-zA-Z0-9\\-\\._\\?\\,\\'/\\\\\\+&%\\$#\\=~])*$
It seems to work.Are you sure? -
Email Validation - Regular Expression
Hi,
I want to validate the form of an email address using a regular expression. I have come across one, but I get an error.
Pattern p = Pattern.compile("^([a-zA-Z0-9_\-])+(\.([a-zA-Z0-9_\-])+)*@((\[(((([0-1])?([0-9])?[0-9])|(2[0-4][0-9])|(2[0-5][0-5])))\.(((([0-1])?([0-9])?[0-9])|(2[0-4][0-9])|(2[0-5][0-5])))\.(((([0-1])?([0-9])?[0-9])|(2[0-4][0-9])|(2[0-5][0-5])))\.(((([0-1])?([0-9])?[0-9])|(2[0-4][0-9])|(2[0-5][0-5]))\]))|((([a-zA-Z0-9])+(([\-])+([a-zA-Z0-9])+)*\.)+([a-zA-Z])+(([\-])+([a-zA-Z0-9])+)*))$");the error is: Invalid escape sequence.
It underlines the first set of characters in the expression... from ^([a-zA-Z0-9_\-
any ideas? or does anyone have a good regular expression for validatin emails in java??
Thanks
CraigThis email address is also valid by RFC 2822
this!strange%[email protected]
Your RE does not consider such addresses...
Some validations also check if the domain ends with a
2-letter country code, or
'com'/'org'/'biz'/'info'/'museum' etc.
Not to mention that email addresses can have comments in them as well. -
Struts Validator/Regular Expression
Hi,
I have to validate the input of a field that I defined as in a JSP page:
<html:text property="aField" maxlength="8" />
I would like that the input is a digital number which has at most 8 digits.
I would not allow any space.
To this end, I put in validation configuration something as
<field property="aField" depends="mask">
<arg0 key="label.file.search.aField" />
<var>
<var-name>mask</var-name>
<var-value>^\d{1,8}$</var-value>
</var>
</field>
This works for most cases, but still accpet s " " (only spaces) as valid input. How can I forbid the spaces?
Thanks.
PengyouHi,
I have to validate the input of a field that I
defined as in a JSP page:
<html:text property="aField" maxlength="8" />
I would like that the input is a digital number which
has at most 8 digits.
I would not allow any space.
To this end, I put in validation configuration
something as
<field property="aField" depends="mask">
<arg0 key="label.file.search.aField" />
<var>
<var-name>mask</var-name>
<var-value>^\d{1,8}$</var-value>
</var>
</field>
s works for most cases, but still accpet s " "
(only spaces) as valid input. How can I forbid the
spaces?
Thanks.
Pengyouuse can use the required to disallow spaces.....
example
<field property="firstname" depends="required,mask">
<msg name="mask" key="dynaregistration2.firstname.mask" />
<arg0 key="dynaregistration2.firstname"></arg0>
<var>
<var-name>mask</var-name>
<var-value>${name}</var-value>
</var>
</field>
here required check for spaces and your mask checks for desired pattern......
Note: here name is defined as global constant......if u want to use same mask at different places -
How to define a regular expression using regular expressions
Hi,
I am looking for some regular expression pattern which will identify a regular expression.
Also, is it possible to know how does the compile method of Pattern class in java.util.regex package work when it is given a String containing a regex. ie. is there any mechanism to validate regular expression using regular expression pattern.
Regards,
AbhisekI am looking for some regular expression pattern which will identify a regular
expression. Also, is it possible to know how does the compile method of
Pattern class in java.util.regex package work when it is given a String
containing a regex. ie. is there any mechanism to validate regular
expression using regular expression pattern.It is impossble to recognize an (in)valid regular expression string using a
regular expression. Google for 'pumping lemma' for a formal proof.
kind regards,
Jos -
Looking for a regular expression that doesnt take in account java comments
Does somebody knows the valid Regular Expression to match 'cat', but none of this:
//cat
// cat
// cat
// cat
// something catI've tried with some patterns without success:
[^/][^/](\\s)*cat
(?<!//)catI want to use this, for example, to search java code to detect uses of "System.out" not commented.
thanksThe direct approach--finding the text first and then figuring out whether it's a valid match--won't work. Java supports two other kinds of comment plus string literals, any of which could contain the text you're looking for. Also, comments can contain literals, string literals can contain things that look like comments, even char literals can contain quotation marks. The only way to be sure you're getting valid matches is to actively search for comments and literals so you can ignore them. Pattern p = Pattern.compile(
"//.*+|" // inline comment, or
+ "/\\*(?:[^*]++|\\*(?!/))*+\\*/|" // multiline or javadoc comment, or
+ "\"(?:[^\"\\\\]++|(?:\\\\.))*+\"|" // string literal, or
+ "\'(?:[^\'\\\\]++|(?:\\\\.))*+\'|" // char literal, or
+ "(System\\.out)" // bingo
Matcher m = p.matcher(str);
while (m.find())
if (m.start(1) != -1)
// bingo
} -
Validate Email by regular Expression... Need Help
Dear All,
Requirement:
validate the email ID entered & throw error message, if it is invalid.
DATA c_mailpattern TYPE c LENGTH 60 VALUE
'[a-zA-Z0-9._%-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4} '.
** If @ is present, more than once. Error out
find ALL OCCURRENCES OF '@' in P_email
MATCH COUNT v_count.
if v_count > 1.
v_badpattern = 1.
endif.
** If , is present, once, Error out
find ALL OCCURRENCES OF ',' in P_Email
MATCH COUNT v_count.
if v_count > 0.
v_badpattern = v_badpattern + 1.
endif.
FIND REGEX c_mailpattern IN P_Email IGNORING CASE .
IF sy-subrc <> 0 OR v_badpattern > 0.
Write:/ p_EMAIL, 'has invalid Email format'.
ENDIF.
though this works fine, tester needs me to catch, if domain name has "app.com.com" as invalid email id.
above regex fails in such case.
I searched & found
{messageID=3706355}
messageID=1657369}{
https://wiki.sdn.sap.com/wiki/display/Snippets/E-MAIL+Validation
doesn't help.
I found this regex in a perl program.
[a-z0-9!#$%&'{size:14}*+{size:14}/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?
Can I get help to modify this into ABAP String?
1) I can't bypass the boldened text using Escape characters like #* or '' Can some one help me assign this regex-string into a string variable?
2) This regex is longer than allowed length for a literal.
It can be split into 2 strings, then concatenated & checked.
Edited by: Mallikarjuna J on May 16, 2011 8:23 PM
Edited by: Mallikarjuna J on May 16, 2011 8:26 PMThanks Sebastian, Pratik & Keshav for the replies.
SX_INTERNET_ADDRESS_TO_NORMAL doesn't validate a wrong email ID. It only splits the internet address into mail & domain.
Prathik,
just .com.com is not the point, Bad input could be .net.ent or .net.com or so....
Amol, Thanks, but I keep receiving Error, not found in the 41 line response I get
I think we need to check not line 2 but line 28.
Taking cue from Prathik, I'm planning to put this
*** ls_inputmail-mail is the email-id entered by user.
************ Check for Valid Regular Expression
***** DOT(.) is allowed more than once,
***** @ is allowed only once,
***** , is not allowed.
** If @ is present, more than once. Error out
find ALL OCCURRENCES OF '@' in ls_input_mail-mail
MATCH COUNT v_count.
if v_count > 1.
v_badpattern = 1.
endif.
** If , is present, once, Error out
find ALL OCCURRENCES OF ',' in ls_input_mail-mail
MATCH COUNT v_count.
if v_count > 0.
v_badpattern = v_badpattern + 1.
endif.
** Find if domain part i.e., after @ has errors.
SPLIT ls_input_mail-mail at '@' into v_mailpart v_domain.
* there's a dot in the domain.
if v_domain Co '.' .
* last 2 char can only be country name, not anything else.
SPLIT v_domain at '@' into v_domain1 v_domain2.
* v_domain2 can only be a country name, else error out
select single landx from t005 into v_country
where landx = v_domain2.
if sy-subrc <> 0.
v_badpattern = v_badpattern + 1.
endif.
ENDIF.
FIND REGEX c_mailpattern IN ls_input_mail-mail IGNORING CASE .
IF sy-subrc <> 0 OR v_badpattern > 0.
Write:/ ls_inputmail-mail, 'has invalid email format'.
ENDIF.
However, I was wondering, if there was a way to use escapae characters & make the beow string as a valid regex variable to check email id.
[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?
Nevertheless, Thanks Friends for all your inputs.
Edited by: Mallikarjuna J on May 17, 2011 2:23 PM -
Uri regular expression matching
Hi, for some reason I cannot get a uri to match the following regular expression check.
<If $uri !~ '^/dir/\?somename=(.*)'>
NameTrans fn="restart" uri="/shownomatch?uriwas=$uri"
</If>
<Else>
NameTrans fn="restart" uri="/showamatch?value=$1"
</Else>I can see in the page that is restarted to that it should match by printing out the uriwas parameter.
An example uri that should match but doesn't is /dir/?somename=5f801297-a8f6-42a4-933d-660f2120cd0d
Any thoughts? I've tried a few different valid regular expressions, but cannot get a match.Thank you all for the help.
My main goal was to provide verification that a user has logged in and has the proper authority to access a directory/resource. What I believe I now have is a check to verify that the user has a required cookie and that the value in the cookie matches the parameter in $query.
Below is what I now have in the server's obj.conf file. Let me know if you think there is something that I am missing.
<If $uri =~ '^/ValidationApp/*'>
<Client security="false">
NameTrans fn="redirect" url-prefix="https://server.domain.edu"
</Client>
</If>
<If $uri !~ '^/ValidationApp/*'>
<Client security="true">
NameTrans fn="redirect" url-prefix="http://server.domain.edu"
</Client>
</If>
<If $uri =~ "/SomeDir/*">
<If not defined $query or not defined $cookie{"$(lookup('cookiemap.conf','/SomeDir'))"} or $query !~ 'uuid=(.*)' or $& ^ $cookie{"$(lookup('cookiemap.conf','/SomeDir'))"}>
NameTrans fn="restart" uri="/ValidationApp/CookieCheckServlet?loc=$uri&uid=$(uuid())&ReqInfo=$(lookup('cookiemap.conf','/SomeDir'))"
</If>
</If>
<If $uri =~ "/AnotherDir/*">
<If not defined $query or not defined $cookie{"$(lookup('cookiemap.conf','/AnotherDir'))"} or $query !~ 'uuid=(.*)' or $& ^ $cookie{"$(lookup('cookiemap.conf','/AnotherDir'))"}>
NameTrans fn="restart" uri="/ValidationApp/CookieCheckServlet?loc=$uri&uid=$(uuid())&ReqInfo=$(lookup('cookiemap.conf','/AnotherDir'))"
</If>
</If>The servlet used in the restart checks to see if the required cookie exists (ReqInfo) and if the uuid value (uid) is set in the session. If so it forwards to the uri (loc). If not it forwards to a login form the checks the user ID/password. It adds the uid to the session, creates the cookie, and forwards back to the requested uri.
The Client security checks are down to make sure the user uses HTTPS when entering their user ID/Password. -
Help With Regular Expression In Apex Validation
Apex 3.2
There is a validation type of regular expression in apex, but I have never used regular expression before,
so a little help is appreciated.
I need to validate a field. It is only allowed to contain alpha characers, numbers, spaces and the - (dash) character.
I have tried several times to get this working
eg
[[:alpha:]]*[[:digit:]]*[[:space:]]*[-]*
^[[:alpha:][:digit:][:space:]-]+?
and others, but just can't to get the syntax correct.
Can someone help me with this please
GusExample:
SQL> ed
Wrote file afiedt.buf
1 with t as (select 'This is some example text' as txt from dual union all
2 select 'And this is the 2nd one with numbers' from dual union all
3 select 'And this allows double-barrelled words with hyphens' from dual union all
4 select 'But this one shouldn''t be allowed!' from dual
5 )
6 --
7 select *
8 from t
9* where regexp_like(txt, '^[[:alnum:] -]*$')
SQL> /
TXT
This is some example text
And this is the 2nd one with numbers
And this allows double-barrelled words with hyphens -
Inline display of error message for a regular expression validation
Hi All,
I am using ApexLib in my application.
I am using regular expression validation for some of the items.
Those validation will happen when the button is pressed and the message will be displayed as per the error.
But, I want the errors to be displayed immediately when the focus is away from that item.
as we do for required items.
could anybody help me to achieve it?
Thanks in advance
bye
SrikaviHi Srikavi,
to achieve a Validation of an item when leaving the field you'll have to use some javascript code (as ApexLib does internally).
What do you need:
- onChange - Event on your Item
- some Javascript code which is called in the onChange Event (you can put this code either in your page html header or, if it is used more often in your application, in a seperate js File)
- call the ApexLib method apexlib.error.showError to display your error
I actually never tried it myself, but i'm pretty sure that this will work (according to what i've seen in the ApexLib code).
Have fun and tell us how it went,
Peter
Edited by: peter_raganitsch on Sep 5, 2008 11:56 AM -
Using regular expressions for validating time fields
Similar to my problem with converting a big chunk of validation into smaller chunks of functions I am trying to use Regular Expressions to handle the validation of many, many time fields in a flexible working time sheet.
I have a set of FormCalc scripts to calculate the various values for days, hours and the gain/loss of hours over a four week period. For these scripts to work the time format must be in HH:MM.
Accessibility guidelines nix any use of message box pop ups so I wanted to get around this by having a hidden/visible field with warning text but can't get it to work.
So far I have:
var r = new RegExp(); // Create a new Regular Expression Object
r.compile ("^[00-99]:\\] + [00-59]");
var result = r.test(this.rawValue);
if (result == true){
true;
form1.flow.page.parent.part2.part2body.errorMessage.presence = "visible";
else (result == false){
false;
form1.flow.page.parent.part2.part2body.errorMessage.presence = "hidden";
Any help would be appreciated!Date and time fields are tricky because you have to consider the formattedValue versus the rawValue. If I am going to use regular expressions to do validation I find it easier to make them text fields and ignore the time patterns (formattedValue). Something like this works (as far as my very brief testing goes) for 24 hour time where time format is HH:MM.
// form1.page1.subform1.time_::exit - (JavaScript, client)
var error = false;
form1.page1.subform1.errorMsg.rawValue = "";
if (!(this.isNull)) {
var time_ = this.rawValue;
if (time_.length != 5) {
error = true;
else {
var regExp = /^([01]?[0-9]|2[0-3]):[0-5][0-9]$/;
if (!(regExp.test(time_))) {
error = true;
if (error == true) {
form1.page1.subform1.errorMsg.rawValue = "The time must be in the format HH:MM where HH is 00-23 and MM is 00-59.";
form1.page1.subform1.errorMsg.presence = "visible";
Steve -
Validation for regular expressions special characters in java
Hi,
I need to validate an user name field to an application while creating that. It has to contain only alpha numerics. can you give me the regular expression and also how to implement that.
thanks,
VJDo your own work. Look up the documentation on Pattern and make an attempt at validating a String yourself. Then worry about implementing a GUI on top of that.
-
Using regular expressions for validation in i18n
Can we use regular expressions for validation of inputs in a java application taking care of i18N aspects too. Zip code for different locales are different. Can we use regular expressions to validate zipcode inputs from different locales
hi,
For that shall i have to create individual patterns for matching the inputs from different locales or a single pattern will do in the case of validating phone nos. around the world, zip codes etc. In case different patterns are required, programmer should have a konwledge of difference in patters for different locales.
regards
sdas -
Regular Expressions - Email Validation
According to RFC-2822 and RFC-2821 specifications the local part of email addresses are allowed to contain a whitespace character as long as it is within quotations. The rest of my regular expression works fine I am battling to find out how to match the above mentioned pattern. Here is the first part of my expression...
([\"(\\w|\\s|\\p{Punct}){1,}\"])
If there is a whitespace character I need to make sure it is surrounded with quotations
Any help will be much appreciated!AmitChalwade123456 wrote:
it's client side validation ( java script regex) must be used ! Since when are client side validations recommended above server side validations?
What would happen if the client disabled Javascript or hacked the Javascript code?
i think
/\S+@\S+\.\S+/;this might help uThis makes no sense. It just checks on availability of the '@' and '.' in that order in the email address. It doesn't check it if contains valid characters nor checks if it is surrounded by quotes if the actual address contains spaces.
Maybe you are looking for
-
Remote Procedure Call Failed - Verifying Account prior to establishing PIN as sign in option
PC Settings / Accounts / Sign in options / PIN / Verify Account info / : I enter my Microsoft Account password and receive the following message: "Remote procedure call failed" Cannot cancel - screen keeps reappearing. I have successfully establishe
-
Vendor and Purchase organisation pick up while creating PO from MD04
Hi iam creating a PO by double clicking the PR in md04 , the PO screen is poped up but vendor is not picked automatically though i maintained fixed vendor in source list for the material and plant. please help me out chris
-
Cannot start FIMSynchronizationService after applying ServicePack for SharePoint 2013 Server
Dear all, Yesterday we have applied SP1 for SharePoint 2013 on our SharePoint Farm (1 one server + 1 db server). Unfortunately the FIMSynchronizationService (Forefront Identity Manager Synchronization Service) will not start anymore after applying th
-
Oracle 10G Database Control and Scheduling OWB Process Flow
Does anyone know how to go about scheduling an OWB Process Flow from Oracle 10G Data Base Control. I knew how to do this with Oracle Enterprise Manager 9.2 but we recently upgraded to Oracle Db 10G and the interface has changed significantly. Now the
-
Hi All, I have extended the standard CO. Below is my code. processRequest(OAPageContext pageContext,OAWebBean webbean) super.processRequest(pageContext,webbean); processFormRequest(OAPageContext pageContext,OAWebBean webbean) super.processRequest(pag