Skip to content

Commit

Permalink
Fix Bio regular expressions (#378)
Browse files Browse the repository at this point in the history
* Add bioPart std::vector

* Adjust bio vector

* Add bio() method to the Person class

* Add bioSupporter and bioFormats vector

* Add bio() method implementation

* Add test for the Person bio

* Add BioHelper to check if the bio generated is valid

* Add method to the Internet class to check if an emoji is valid

* Implement BioHelper::checkTokenFormat()

* Add missing includes

* Adjust regex expressions

* Add comment to checkIfEmojiIsValid() method

* Adjust regex matching

* Delete useless std::cout

* Format code

* Fix regular expressions
  • Loading branch information
MikelKokoshi authored Dec 4, 2023
1 parent 423d902 commit 3d63dc4
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/common/BioHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ namespace faker
{
bool BioHelper::checkTokenFormat(const std::string& bio)
{
const std::regex firstRegex{R"(^[a-zA-Z0-9_]+$)"};
const std::regex firstRegex{R"(^(\w+\s?\w+)$)"};
const std::regex secondRegex{R"(^(\w+\s?\w+), (\w+\s?\w+)$)"};
const std::regex thirdRegex{R"(^(\w+\s?\w+), (\w+\s?\w+), (\w+\s?\w+)$)"};
const std::regex fourthRegex{R"(^(\w+\s?\w+), (\w+\s?\w+), (\w+\s?\w+), (\S+)$)"};
const std::regex fifthRegex{R"(^(\w+) (\w+)$)"};
const std::regex sixthRegex{R"(^(\w+) (\w+) (\S+)$)"};
const std::regex seventhRegex{R"(^(\w+) (\w+), (\w+\s?\w+)$)"};
const std::regex eigthRegex{R"(^(\w+) (\w+), (\w+\s?\w+) (\S+)$)"};
const std::regex fifthRegex{R"(^(\w+\-?\w+) (\w+)$)"};
const std::regex sixthRegex{R"(^(\w+\-?\w+) (\w+) (\S+)$)"};
const std::regex seventhRegex{R"(^(\w+\-?\w+) (\w+), (\w+\s?\w+)$)"};
const std::regex eigthRegex{R"(^(\w+\-?\w+) (\w+), (\w+\s?\w+) (\S+)$)"};

std::smatch matches;
//
Expand Down

0 comments on commit 3d63dc4

Please sign in to comment.