Email characteristics test

BigDaveBigDave Member Posts: 2,239
edited June 2017 in Working with GS (Mac)

My goal is to confirm a player input (text) to be an email.
Besides of a min. of 5 Characters I also do check that it contains "@".

Problem:
If I check if it contains "." it accepts any character as an "."
While the other checked symbols, numbers and letters can be differentiated by the "contains" of "text expression"

I assume its a gamesalad bug?

Comments

  • BigDaveBigDave Member Posts: 2,239

  • BigDaveBigDave Member Posts: 2,239

  • HopscotchHopscotch Member, PRO Posts: 2,782
    edited June 2017

    @BigDave escape it like this

    if contains "%."

    Or better, use textFind to check that at least one "." appears after the "@".

  • BigDaveBigDave Member Posts: 2,239

    Done! Thanks!

  • BigDaveBigDave Member Posts: 2,239
    edited June 2017

    Ha I got another issue.
    I check if the @ is before the .
    which works fine.

    Tough if an email look like this hey.hey@gmail.com
    it is seen as a wrong email

    how do I say start checking after the @?

    current version
    textFind( scene.Email ,"@,1) < textFind( scene.Email ,%.",1)

  • HopscotchHopscotch Member, PRO Posts: 2,782
    edited June 2017

    @BigDave

    first find the position of "@"
    then use textSubStr to get the string after the "@, i.e. gmail.com"
    then check for a "."

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited June 2017

    Decided to try my hand at this. I think I came up with a pretty good parser but... it fails because of a textFind() that somehow finds a period within text that doesn't contain one. Hmm.

    Edit: forgot about this: http://forums.gamesalad.com/discussion/comment/525201/#Comment_525201

  • HopscotchHopscotch Member, PRO Posts: 2,782

    @tatiang I showed up top how to escape the "."
    You need to use "%." in LUA

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    Yep, @Hopscotch... reading ftw. Oops! :D

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    Here's a version where the period detection works properly.

  • BigDaveBigDave Member Posts: 2,239
    edited June 2017

    Thanks guys using your solution @tatiang
    the separation of username, domain and the @ position is nice

Sign In or Register to comment.