Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: [TGUI] EditBox validator (regex)  (Read 2278 times)

0 Members and 1 Guest are viewing this topic.

marcolo2307

  • Newbie
  • *
  • Posts: 3
    • View Profile
    • Email
[TGUI] EditBox validator (regex)
« on: July 03, 2017, 01:23:39 am »
Hi!

I want to get IP from EditBox, but regex don't work correctly. My example regex:
Code: [Select]
"(([0-9]?){3}\\.){3}([0-9]?){3}"Works on std::regex and online tester, doesn't work on EditBox ;/

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: [TGUI] EditBox validator (regex)
« Reply #1 on: July 03, 2017, 07:56:40 am »
As far as I know, TGUI has its own forum.
Laurent Gomila - SFML developer

texus

  • Hero Member
  • *****
  • Posts: 505
    • View Profile
    • TGUI
    • Email
Re: [TGUI] EditBox validator (regex)
« Reply #2 on: July 03, 2017, 11:08:32 am »
Yeah, for further questions about TGUI it's probably better to ask them on forum.tgui.eu.

The regex for edit box has a rather limited functionality. If you can match the string with std::regex then pasting it in edit box while the regex is set should also work. But because the regex has to be valid at any time, you can't type in the edit box because any incomplete ip address will be rejected. It would be better to allow the user to type any combination of numbers and dots and processing the value yourself later.
TGUI: C++ SFML GUI