Validate string to verify it is (probably) a phone number

What would I do in expression editor to validate that a string meets the basic constraints for a North American phone number? All I care do at this point is compare the entered string and make sure it matches this pattern: [2-9]XX[2-9]XXXXXX
Thanks much!

I'm curious, where/how are you getting the number?
Either way, assuming you've already validated the length of digits you can skip the need for regex, granted this method is less robust but simpler to implement:
if(phoneNumber.charAt(0) <= 49 || phoneNumber.charAt(3) <= 49)
     True:
          Number is invalid
     False:
          Number is valid.
The way this works is as such: based on the pattern you describe, either the first digit, or the 4th must be between 2 and 9. Based on that, we grab those digits and compare them. The value 49 is the integer value of the character '1', so by testing less than or equal too, you can ensure that the number provided is either 0 or 1
As I said, the code Anthony provided is more robust, you can match on a greater granularity (although I believe his implementation could be improved, no offense Anthony), however if you want to simply ensure they don't input a 0 or 1.
If you'd like to see a table of where all the ASCII string values are, check:
http://www.asciitable.com/

Similar Messages

  • How to delete a phone number from "you can be reached by Imessages at" the phone number that I want to delete says verifying

    Hi, my family all uses the same AppleID we never had a problem until this morning. I got a "phone number added to Iphone, Iphone is now using xxx-xxx-xxxx message it was my husbands number so I accepted it. Now he is getting all my text I went into the send/recieve and his phone number was there and on the same line it says verifying and it won't let me do anything. Does anyone know if the verifying will stop or when it should stop so I can delete his number? He lives in a different location and wants to wait until I get there to set up his own AppleID. Thanks

    I used the post that said to turn off Imessage and facetime and back on-
    it worked. My husband is new to using an Iphone so when I go to see him I will set him up a iCloud account like you suggested. Thank you

  • How can I verify my phone number to use FaceTime and iMessage instead of email address!?

    My iMessage and FaceTime are both working, but it still says "Waiting for activation.." right under both the FaceTime and iMessage settings. Under the "Receive At" setting, my email address is entered in. When I press on my email address, it takes me to a page shows my Apple ID, my email address, and in gray it says "Vertifying" with my phone number also in gray. I am currently out of the country and am using wifi for my apps, iMessage, FaceTime, and checking email. Why does it still say waiting for activation even though I can use everything fine?

    I want that to be my last option if I need to. I don't want to delete everything and update everything back over. Are the finished with updating the severs? Last night I was unable to sign in using my Apple ID to use FaceTime or iMessage, but now I am logged in, but I can't verify my number. My iMessages are going through with my email instead of my number

  • Validate Phone Number in CRM - transaction BP

    hello, I am interested in validate the phone number inserted by the user when creating a new business partner, while using transaction BP in CRM.
    IS there any BADI or user-exit to validate this kind of data of the business partner for de BP transaction??
    Thank you a lot!

    Hello all,
    we have this same problem and have almost solve it.
    We have created a Z function module, which has been inserted in the BDT calls for event DCHCK. Our FM is rightly called and we are able to send an error message using FM 'BUS_MESSAGE_STORE'.
    Then, our problem now is: How to get the values for telephone, mobile and e-mail address?
    We need to check this data, but are not able to see it in the debugger...
    Thanks in advance and Best Regards

  • Incompatable types:java.lang.String and phone number[]

    i am trying to run a search of an array but i can not get the Class to compile.
    The code is below:
    public class People
    private int numberSize;
    private PhoneNumber[] number;
    public People(int maxNumberSize)
    number = new PhoneNumber[maxNumberSize];
    numberSize = 0;
    public void addAPerson(String personName, String Number)
    PhoneNumber thePerson = new PhoneNumber (personName, Number);
    number[numberSize] = thePerson;
    numberSize++;
    private String findPhoneNumber(String person)
    int location = -1;
    for (int i=0; i<numberSize; i++)
    if (number.getNumber() == number)
    location = i ;

    Hi.
    you're using
    private String findPhoneNumber(String person)
    int location = -1;
    for (int i=0; i<numberSize; i++)
    if (number.getNumber() == number)
    location = i ;
    }Now - your method gets a name of a person, right?
    And you want to find that person's object in the array, and retrieve the phone number.
    Your first problem lies in -
    if (number.getNumber()==number)Can you see the problem? number is an array. You want to check the data of the object in the array's location i, but you're not doing it. So, first, you would change it to read
    if (number.getNumber()==number)
    Now - what are we doing here? You are getting the number of the person in place i in the array, by using the getNumber() method. Then you check if it equals to number.
    It won't be, because number is the array itself. And anyway - you are doing it the other way around, because you want to check if the object in place i in the array has the name that you got previously.
    So, you're looking at something like
    if (number.getName()==person)
    (person is the argument you got on calling the method, remember?)
    ok.
    Now you can go on with the rest.
    Nimo.

  • I accidentally put in the wrong phone number in to verify my iCloud Keychain... How can I go back and fix it?

    So I updated my iPhone5 this morning to iOS 7.03 right, then it asked me for my phone number to verify my iCloud Keychain. The problem with that is that I accidentally put in the wrong number. How am I suppose to fix that? How can I go back and put my actual number in?

    Read here to remove & setup again:
    http://support.apple.com/kb/TS4644?viewlocale=en_US

  • Phone number won't verify for iMessage after 5.1 Upgrade

    Anyone have any solution yet?  I have tried hard resets and still nothing.  Under the iMessage slider it say Waiting for Activation and clicking through the "receive at" button it says "Verifying" next to my phone number.  People are able to receive iMessages from my email though? Strange.  Any help is appreciated!!

    Read through this thread, you may find a solution that will work for you: https://discussions.apple.com/thread/3374660?start=0&tstart=0.  (You might also turn off you phone and remove and reinsert your sim just to be sure it's making good contact.)

  • I change my phone number and i want to verify my key chain on my new phone

    I change my phone number and i want to verify my key chain on my new phone.. but it send to my old number.. I already change the number at system preference but it still send to my old number.. can you help me?

    All the publicly available information is here:
    http://www.apple.com/ios/ios7
    There are links on that page to features.

  • I am trying to verify my keychain account, but the verification code it being sent to a phone number I don't have access to

    I am trying to verify my keychain account, but the verification code it being sent to a phone number I don't have access to. What can I do?

    Frequently asked questions about two-step verification for Apple ID - Apple Support
    You'll need another trusted device, or your Recovery Key, which you may have elected Apple to keep for you.

  • How to execute a string formula and assign the result to a number field

    How to execute a string formula and assign the result to a number field
    Hi,
    we have a function that returns a string like this:
    '(45+22)*78/23'
    After we should calculate this string and assign the value to a numeric block field
    Example:
    k number(16,3);
    k:=fun1('(45+22)*78/23'); where fun1 execute and translate to number the string.
    Does exist a function like fun1 ??
    How can we do ?
    Regards

    Hello,
    this is the code that does the job:
    SQL> set serveroutput on
    SQL> DECLARE
    2 ch VARCHAR2(20) :='22+10' ;
    3 i NUMBER ;
    4 BEGIN
    5 EXECUTE IMMEDIATE 'select ' || ch || ' from dual' INTO i;
    6 dbms_output.put_line ('i = ' || TO_CHAR(i));
    7 END ;
    8 /
    i = 32
    Procédure PL/SQL terminée avec succès.
    SQL>
    just you have to do is to create a small stored function that take the string to calculate and return the number result
    Francois

  • Why does it say "verifying phone number" in settings under iMessage? It worked properly in past.

    Why does it say "verifying phone number" in settings under iMessage? It worked properly in past.

    Go to supportprofile.apple.com and remove your device. Alternatively you can call in to apple and have Apple look up your phone number. They may be able to remove it from their end.
    If it does not show up in either of these places, have the people whe own the other iPhone send you a message> this message will be blue for an iMessage> have them push an hold on that message and select the option "send as text"> this should send the message as green> do this two - four time till it starts sending as green on its own.> this should fix it.

  • I need to cancel my account, but I cannot verify my identity over the phone

    I need to cancel my account, but I cannot verify my identity over the phone as I do not know what pin I entered, or what security answer I put in, and of course there are no recent numbers in my phone, but I'm still me, and I'm still the one who pays my bill, and I still need to close my account, and I need a way to do that. Honestly I'm getting quite frustrated here and am considering starting a lawsuit or submitting my story to a newspaper, I like verizon and thought I would get my next phone under verizon as well, but now I'm not so sure. But whatever the the case, even if I need to go somewhere in person with my id to prove that I'm the owner of my account, I need it closed.
    I really hope that someone here can help me solve this issue, or direct me to someone who can solve this issue for me. I think that the better business bureau would find it as atrocious as I do that a person could get looped into payments that they don't want and cannot get out of, now I know that this was not the intention, but I really do need to cancel my plan because I cannot afford the bill.

    How To: Direct Message  and  AyaniB_VZW

  • Unable to verify a new phone number (Error 6)

    Hey, 
    Im trying to add a new phone number to my Skype account, but for whatever reason im not able to add the and verify my new number, all i get is an error 6.. can any help? 
    I have already tried with/without +66 and 0066, same problem.
    See attached screenshot.
    Thanks in advance
    //Rob
    Attachments:
    Screen Shot 2014-12-10 at 13.51.26.png ‏79 KB

    I'm trying to add a number that appears when sending an SMS via skype but I get a message saying "SMS_FAILUREREASON_error 6". This is for a UK number. Anyone from Skype out there to help?! 
    I see many people who've expressed this issue above, yet it seems nobody has tried to resolve it. What is the point of this forum then? How else can we report the problem and get it resolved -anyone know??
    Attachments:
    Screen Shot 2015-01-21 at 23.59.21.png ‏75 KB

  • HT3529 I have i0S7.0.2 on my iPhone 5.  I want to to send a new string of messages to someone but every time I type in the recipient's phone number, the old string of messages pop up.  Is there any way to start a new, fresh string?

    I have i0S7.0.2 on my iPhone 5.  I want to to send a new string of messages to someone but every time I type in the recipient's phone number, the old string of messages pop up.  Is there any way to start a new, fresh string?

    SadisticIron wrote:
    i just baught my first iphone and it is a jalbroken
    Buzz! Thank you for playing!
    Discussing jailbroken devices is forbidden here by the Terms of Service.
    You can not get help here.

  • Validate text filed - phone number or integer?

    I am trying to validate a field that requires a phone number but I want to make sure that the user enters only numbers and cannot enter a (1) before the number.
    Can anyone help?
    Thanks.

    Have you seen this page?
    http://labs.adobe.com/technologies/spry/samples/validationwidgets/TextfieldValidationSampl e.html

Maybe you are looking for

  • Error in generating Smartforms

    Hi All, i have a created a smartforms, on moving to PRD it is generating error as shown in screenshot. Please tell me what can i do, i am not getting what is the error.

  • Cannot view or print data in fillable form fields

    I created a fillable form and users complete the form and email back to me.  For some, but not all, users, when I get their form, the data in the fields is not visible unless I click on field.  At first I thought they emailed me a blank form, but whe

  • Running a Photoshop written action through Bridge

    I have an action that was written in CS - its a basic contact sheet action based on the one built into photoshop.  The guys I am working for use it in their work flow to proof their pictures of senior high schoolers.  I loaded this action into PS CS3

  • HT4053 how do i change the name of my iPhone?

    How do I change the name which identifies my iPhone

  • De-focus panel so that normal text entry continues to work?

    I build an extension using Flash Builder and Extension Builder 2. When the user clicks a button on my extensions panel, the main window loses focus & you can't enter any text into textfields. I tried to give the focus back using app.activate();  CSXS