Replace any non-word characters with a dash.
490524
def dashrepl(value):
    
    patt = re.compile(r'\W', re.UNICODE)
    return re.sub(patt, '-', value)
544644
public static function dashless(string $s)
	{
		$s = trim($s);
		$s = self::replace($s, '#\-#', '');

		return $s;
	}
996454
def _str_dash(self, depth, no_repeat, obj):
        """"""
        if self.indent:
            # '-' is default character indicating hierarchy level
            # '=' is used to indicate a hierarchical path printed in detail previously.
            single_or_double = not no_repeat or not obj.children
            letter = '-' if single_or_double else '='
            return ''.join([letter]*depth)
        return ""
1220573
def clean_chars(value):
    ""
    value = value.replace('\xb9', ' ')
    value = value.replace('\xf8', ' ')
    value = value.replace('\xab', ' ')
    value = value.replace('\xa7', ' ')
    value = value.replace('\xa8', ' ')
    value = value.replace('\xfb', ' ')
    value = value.replace('\xfc', ' ')
    return value
76182
def dasherize(word)
      classify(word).to_s.gsub(/::/, '/').
            gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
            gsub(/([a-z\d])([A-Z])/,'\1_\2').
            tr("_", "-").downcase
    end
673072
def build
      text = @word.hyphenated? ? remove_dash(@word.to_s) : add_dash(@word.to_s)

      Word.new(text)
    end
237370
def clean(self, text):
        """"""
        return ''.join([c for c in text if c in self.alphabet])
578698
def _remove_invalid_char(s):
    """"""

    s = ''.join([i if ord(i) >= 32 and ord(i) < 127 else '' for i in s])
    s = s.translate(dict.fromkeys(map(ord, "_%~#\\{}\":")))
    return s
1234436
def update_chars(self):
        """"""
        # NOTE: We spoof non-Unix files by returning '\n' on StopIteration
        self.prior_char, self.char = self.char, next(self.characters, '\n')
        self.idx += 1
270497
def _run_strip_accents(self, text):
        """"""
        text = unicodedata.normalize("NFD", text)
        output = []
        for char in text:
            cat = unicodedata.category(char)
            if cat == "Mn":
                continue
            output.append(char)
        return "".join(output)
249447
def OnChar(self, event):
        """"""

        key = event.GetKeyCode()

        if key < wx.WXK_SPACE or key == wx.WXK_DELETE or key > 255 or \
           chr(key) in string.digits:
            event.Skip()
264017
function dashProperCase(str) {
        if ( !str.length ) {
            return str;
        }
        return str.split('-').map(function (piece) {
            if ( piece.length ) {
                return piece.substring(0, 1).toUpperCase() + piece.substring(1);
            }
            return piece;
        }).join('-');
    }
1156107
def replace_character_sequence_with_hyphen(string, mode: "default")
      replaceable_char =
        case mode
        when "raw"
          SLUGIFY_RAW_REGEXP
        when "pretty"
          # "._~!$&'()+,;=@" is human readable (not URI-escaped) in URL
          # and is allowed in both extN and NTFS.
          SLUGIFY_PRETTY_REGEXP
        when "ascii"
          # For web servers not being able to handle Unicode, the safe
          # method is to ditch anything else but latin letters and numeric
          # digits.
          SLUGIFY_ASCII_REGEXP
        else
          SLUGIFY_DEFAULT_REGEXP
        end

      # Strip according to the mode
      string.gsub(replaceable_char, "-")
    end
1142699
def slugify(s):
    
    s = strip_accents(s.replace("'", '').lower())
    return re.sub('[^a-z0-9]+', ' ', s).strip().replace(' ', '-')
1256914
def substitute_values(text, values):
    """"""
    shift, final_text, shifts = 0, text, defaultdict(int)
    for value in values:
        first = value['old_span'][0] + shift
        second = value['old_span'][1] + shift
        new_s = value['new_surface']
        final_text = final_text[0:first] + new_s + final_text[second:]
        shift += len(new_s) - len(value['old_surface'])
        for char in range(first + 1, len(final_text)):
            shifts[char] = shift

    logging.debug(u'Text after numeric conversion: "%s"', final_text)

    return final_text, shifts
360839
def replace_each(text, items, count=None, strip=False):
    '''
    
    '''
    for a,b in items:
        text = replace(text, a, b, count=count, strip=strip)
    return text
418891
def rebase(self, text, char='X'):
        
        regexp = re.compile(r'\b(%s)\b' % '|'.join(self.collection),
                            re.IGNORECASE | re.UNICODE)

        def replace(m):
            word = m.group(1)
            return char * len(word)

        return regexp.sub(replace, text)