PhoneNumbers.PhoneRegex.MatchBeginning C# (CSharp) Method

MatchBeginning() public method

public MatchBeginning ( String value ) : Match
value String
return System.Text.RegularExpressions.Match
        public Match MatchBeginning(String value)
        {
            return beginRegex_.Match(value);
        }
    }

Usage Example

        /**
         * Attempts to extract a match from a {@code candidate} character sequence.
         *
         * @param candidate  the candidate text that might contain a phone number
         * @param offset  the offset of {@code candidate} within {@link #text}
         * @return  the match found, null if none can be found
         */
        private PhoneNumberMatch ExtractMatch(String candidate, int offset)
        {
            // Skip a match that is more likely a publication page reference or a date.
            if (PUB_PAGES.Match(candidate).Success || SLASH_SEPARATED_DATES.Match(candidate).Success)
            {
                return(null);
            }
            // Skip potential time-stamps.
            if (TIME_STAMPS.Match(candidate).Success)
            {
                String followingText = text.ToString().Substring(offset + candidate.Length);
                if (TIME_STAMPS_SUFFIX.MatchBeginning(followingText).Success)
                {
                    return(null);
                }
            }

            // Try to come up with a valid match given the entire candidate.
            String           rawString = candidate;
            PhoneNumberMatch match     = ParseAndVerify(rawString, offset);

            if (match != null)
            {
                return(match);
            }

            // If that failed, try to find an "inner match" - there might be a phone number within this
            // candidate.
            return(ExtractInnerMatch(rawString, offset));
        }
All Usage Examples Of PhoneNumbers.PhoneRegex::MatchBeginning