naveenkumar's Profile

1778
Points

Questions
37

Answers
102

  • Asked on January 11, 2019 in No Category.

    Alternately use re.match() method:

    Using re.match() will return either None, which evaluates to False, or match object, which will always be True.

    Only if we want information about the part(s) that matched in regular expression to check out the contents of the match object.

    • 0 views
    • 13374 answers
    • 0 votes
  • Asked on January 11, 2019 in Regex.

    Get Filename Without Extension in Python for that use:

    os.path.splitext(filename)[0]
    
    

    Above code handle a filename like .bashrc correctly by keeping the whole name.

     

    • 2353 views
    • 9 answers
    • 0 votes
  • Asked on January 11, 2019 in Regex.

    Also use gsub() is return only the capture group:

    In order to select elements outside to capture group as mentioned in the gsub().

    (…) elements of character vectors ‘x’ which are not substituted will be returned unchanged.

    And text to be selected lies in the middle of some string, adding .* before and after the capture group should return it.

    gsub(".*\\((.*?) :: (0\\.[0-9]+)\\).*","\\1 \\2", "(sometext :: 0.1231313213)")
      [1] "sometext 0.1231313213"
    
    • 692 views
    • 5 answers
    • 0 votes

  • Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 4096 bytes) in /home/wikitechy/public_html/forums/wp-includes/post.php on line 773

    Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 4096 bytes) in /home/wikitechy/public_html/forums/wp-includes/functions.php on line 2121