Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 2 of 2 FirstFirst 12
Results 16 to 18 of 18
  1. #16
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,965
    Thanks
    79
    Thanked 4,429 Times in 4,394 Posts
    *SIGH*

    Why is it too complicated to just add in the function that I gave you???

    But okay, we can hack it another way:
    Code:
    var str = email.body_text;
    var theMatch = str.match(/number\:\s+(\d+)$/i);
    var refStr = theMatch ? theMatch[0] : "no valid number given";
    externalReferenceNumberCreate(current.sys_id, 'Client reference number',refStr, 'Client number');
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  2. Users who have thanked Old Pedant for this post:

    narelle (01-07-2014)

  3. #17
    New Coder
    Join Date
    May 2013
    Posts
    24
    Thanks
    12
    Thanked 0 Times in 0 Posts
    It's probably my lack of experience or that some suggestions don't work in the environment I'm working in; but your explanations are sometimes over my head/don't work as might be expected elsewhere. I'll work with what you've provided, and thanked you for your posts.
    Last edited by narelle; 01-07-2014 at 02:50 AM.

  4. #18
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,965
    Thanks
    79
    Thanked 4,429 Times in 4,394 Posts
    I think the major point you have been missing is that, if there is *NO MATCH*, then your code will just get either an error or a blank string.

    My code, on the other hand, CHECKS for the missing number and supplies a message (which you can change to whatever you want) to say so.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.


 
Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •