logo
Tags down

shadow

Regexp to parse out a person's name?


By : MKS
Date : October 17 2020, 11:12 AM
To fix the issue you can do No, you can't use regular expressions for this. The only chance you have is if the document is always in the same format and you can find the name based on the context surrounding it. But this probably isn't the case for you.
If you are asking your applicants to submit their résumé online you could provide a separate field for them to enter their name and any other information you need instead of trying to automatically parse résumés.
code :


Share : facebook icon twitter icon

GET Persons Birthday, Days Left Until Bday, and Persons Age this year in MS SQL 2012


By : Matt Trengrove
Date : March 29 2020, 07:55 AM
With these it helps The script I have below works great for displaying birthdays but it will not display the birthday on the birthday date and also how do I get the day's left for that person's birthday ? and finally how old will the person be on this birthday. , Try this for age:
code :
CASE 
  WHEN DATEPART(DAYOFYEAR, DOB) < DATEPART(DAYOFYEAR, GETDATE()) 
    THEN DATEDIFF(YEAR, DOB, GETDATE()) 
  ELSE 
    DATEDIFF(YEAR, DOB, GETDATE())-1 
END
DATEDIFF(DAY, GETDATE(), DATEADD(YEAR,DATEDIFF(YEAR, DOB, GETDATE()), DOB))

Parse html with regexp


By : Rafael Ribeiro
Date : March 29 2020, 07:55 AM
I hope this helps . I want to find all

blocks in this example: , with DOMDocument:
code :
$dom = new DOMDocument();
@$dom->loadHTML($html);

$nodes = $dom->getElementsByTagName('body')->item(0)->childNodes;

$flag = false;
$results = array();

foreach ($nodes as $node) {
    if ( $node->nodeType == XML_ELEMENT_NODE &&
         preg_match('~^h(?:[12]|(3))$~i', $node->nodeName, $m) ):
        if ($flag)
            $results[] = $tmp;
        if (isset($m[1])) {
            $tmp = $dom->saveXML($node);
            $flag = true;
        } else
            $flag = false;

    elseif ($flag):
        $tmp .= $dom->saveXML($node);

    endif;
}

echo htmlspecialchars(print_r($results, true));
preg_match_all('~<h3.*?(?=<h[123])~si', $html, $matches);

echo htmlspecialchars(print_r($matches[0], true));


parse a string with regexp


By : febri
Date : March 29 2020, 07:55 AM
it helps some times What is the best way if you want to read a input like this: , Maybe the following piece of code matches your requirements:
code :
#include <iostream>
#include <string>
#include <regex>

int main()
{
  std::smatch m;
  std::string str("(1,13) { (22,446) (200,66) (77,103) }");
  std::string regexstring = "(\\(\\s*\\d+\\s*,\\s*\\d+\\s*\\))\\s*(\\{)(\\s*\\(\\s*\\d+\\s*,\\s*\\d+\\s*\\)\\s*)*\\s*(\\})";
  if (std::regex_match(str, m, std::regex(regexstring))) {
    std::cout << "string literal matched" << std::endl;
    std::cout << "matches:" << std::endl;
    for (std::smatch::iterator it = m.begin(); it != m.end(); ++it) {
      std::cout << *it << std::endl;
    }
  }

  return 0;
}

oracle sql: Persons older than the average age of persons with the same nationality


By : Татьяна Иванова
Date : March 29 2020, 07:55 AM
wish of those help I want to list all persons who are older than the average age of persons with the same nationality. There are three tables involved: person, passport, and country. This is what i have so far: , This is a good use case for an analytic function:
code :
SELECT * 
  FROM (select round(months_between(sysdate, dob) / 12) as age,               
               country.name country_name,
               person.name person_first_name, 
               person.surname person_last_name,
               avg(round(months_between(sysdate, dob) / 12)) 
                    over (partition by country.name ) avg_for_country
          from person
                join passport on person.pid = passport.pid
                join country on passport.cid = country.cid
       )
 WHERE age > avg_for_country

Regexp parse string


By : Akshay Choudhary
Date : March 29 2020, 07:55 AM
this will help You already are doing it properly. Just need to pick the right part with slice().
code :
var r = /^(\d)([mhd])$/;
var res = r.exec("2m").slice(1, 3);
console.log(res);
shadow
Privacy Policy - Terms - Contact Us © bighow.org