'Search for a pattern in memory; support regex search
Usage:
MYNAME pattern start end
MYNAME pattern mapname'

def searchmem(self, *arg):

    (pattern, start, end) = normalize_argv(arg, 3)
    (pattern, mapname) = normalize_argv(arg, 2)
    if (pattern is None):
        self._missing_argument()
    pattern = arg[0]
    result = []
    if ((end is None) and to_int(mapname)):
        vmrange = peda.get_vmrange(mapname)
        if vmrange:
            (start, end, _, _) = vmrange
    if (end is None):
        msg(('Searching    for    %s    in:    %s    ranges' % (repr(pattern), mapname)))
        result = peda.searchmem_by_range(mapname, pattern)
    else:
        msg(('Searching    for    %s    in    range:    0x%x    -    0x%x' % (repr(pattern), start, end)))
        result = peda.searchmem(start, end, pattern)
    text = peda.format_search_result(result)
    pager(text)
    return
