Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Function requirements #42

Closed
brinkqiang opened this issue May 21, 2021 · 1 comment
Closed

Function requirements #42

brinkqiang opened this issue May 21, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@brinkqiang
Copy link

brinkqiang commented May 21, 2021

//Add a function similar to the following

std::string strRepos = "https://github.com/fmtlib/fmt";
std::string strUrl;
std::string strProto;
std::string strUserName;
std::string strProject;
scn::scan(strRepos , "{0}://{1}/{2}/{3}", strProto, strUrl, strUserName, strProject);

@eliaskosunen
Copy link
Owner

Now sort of possible with

std::string url = "https://github.com/eliaskosunen/scnlib";
std::string protocol, domain, username, repo;
// [^:] means accept everything but ':' -> read until ':'
// same for [^/]
auto result = scn::scan(url, "{:[^:]}://{:[^/]}/{:[^/]}/{}", protocol, domain, username, repo);
// result.empty() == true
// protocol == "https"
// domain == "github.com"
// username == "eliaskosunen"
// repo == "scnlib"

Better ergonomics for this are planned to come post-1.0.

@eliaskosunen eliaskosunen added the enhancement New feature or request label Feb 21, 2022
@eliaskosunen eliaskosunen closed this as not planned Won't fix, can't repro, duplicate, stale May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants