word-boundaries

matching whole words while ignoring affixes of words using regex

久未见 提交于 2021-02-05 11:12:33
问题 I am learning a new language and I have created a DB with aprox. 2500 words and 2500 examples of the words. I created a PHP/MySQL web UI with basically shows pictures for each word and when you click them it will play the audio of the word. There is also a context menu to trigger a pop up div that matches and displays all examples where the word occurs. I have been using REGEXP '[[:<:]]$word[[:>:]]' but there are several prefixes/suffixes of words that I want to filter out that do not add any

Word boundaries not matching when the word starts or ends with special character like square brackets

三世轮回 提交于 2020-04-28 12:57:33
问题 I want to replace string which is a square bracket with another number. I am using regex replace method. Sample input: This is [test] version. Required output (replacing "[test]" with 1.0): This is 1.0 version. Right now regex is not replacing the special character. Below is the code which I have tried: string input= "This is [test] version of application."; string stringtoFind = string.Format(@"\b{0}\b", "[test]"); Console.WriteLine(Regex.Replace(input, stringtoFind, "1.0")); There may be

Word boundaries not matching when the word starts or ends with special character like square brackets

青春壹個敷衍的年華 提交于 2020-04-28 12:57:05
问题 I want to replace string which is a square bracket with another number. I am using regex replace method. Sample input: This is [test] version. Required output (replacing "[test]" with 1.0): This is 1.0 version. Right now regex is not replacing the special character. Below is the code which I have tried: string input= "This is [test] version of application."; string stringtoFind = string.Format(@"\b{0}\b", "[test]"); Console.WriteLine(Regex.Replace(input, stringtoFind, "1.0")); There may be

Non-capturing group matching whitespace boundaries in JavaScript regex

断了今生、忘了曾经 提交于 2020-01-21 12:20:29
问题 I have this function that finds whole words and should replace them. It identifies spaces but should not replace them, ie, not capture them. function asd (sentence, word) { str = sentence.replace(new RegExp('(?:^|\\s)' + word + '(?:$|\\s)'), "*****"); return str; }; Then I have the following strings: var sentence = "ich mag Äpfel"; var word = "Äpfel"; The result should be something like: "ich mag *****" and NOT: "ich mag*****" I'm getting the latter. How can I make it so that it identifies

word boundaries in irb

筅森魡賤 提交于 2019-12-22 08:00:04
问题 I'm using Terminal on Snow Leopard. At the command line, if I've typed foo.bar.baz.bang.quuz.quux , when i tap option-B, it moves the cursor backward word by word -- stopping at every period, because it considers a period to be a word boundary. Likewise, option-F moves forward word by word. In irb (0.9.5, ruby 1.8.7), option-B and -F also have this behavior, but the period is no longer treated as a word boundary, which makes these keyboard shortcuts significantly less useful. How can I change

List items run outside of list and div area

感情迁移 提交于 2019-12-21 07:55:43
问题 I'm having an issue with a menu un-ordered list. Whereby the list items are over running the <ul> and <div> boundaries and only starting the next line once it has reach the edge of the screen. Heres the website: http://finalonline.co.uk/mypics/gallery/categories/ 回答1: You can use float: left; on the li s instead of display: inline; . Just remember to also use overflow: hidden; on the parent element (the ul ). Another option would be to use: display: inline-block , but I'm not 100% sure about

Are there JavaScript equivalents of the Vim regular expression start and end of word atoms “\<” and “\>”?

南笙酒味 提交于 2019-12-06 02:55:48
问题 I know most regular expression engines, including the one in JavaScript have \b to match a word boundary, be it at either the start or end of a word. But Vim also has two more specific regular expression atoms: \< matches only the word boundary at the start of a word \> matches only the word boundary at the end of a word Does JavaScript have an equivalent to these atoms, and if not is there a way to express their more precise semantics some other way? 回答1: As far as I know there is nothing

Regular expression to match boundary between different Unicode scripts

我与影子孤独终老i 提交于 2019-12-04 01:04:16
问题 Regular expression engines have a concept of "zero width" matches, some of which are useful for finding edges of words: \b - present in most engines to match any boundary between word and non-word characters \< and \> - present in Vim to match only the boundary at the beginning of a word, and at the end of a word, respectively. A newer concept in some regular expression engines is Unicode classes. One such class is script, which can distinguish Latin, Greek, Cyrillic, etc. These examples are

Regular expression to match boundary between different Unicode scripts

馋奶兔 提交于 2019-12-01 04:18:53
Regular expression engines have a concept of "zero width" matches, some of which are useful for finding edges of words: \b - present in most engines to match any boundary between word and non-word characters \< and \> - present in Vim to match only the boundary at the beginning of a word, and at the end of a word, respectively. A newer concept in some regular expression engines is Unicode classes. One such class is script, which can distinguish Latin, Greek, Cyrillic, etc. These examples are all equivalent and match any character of the Greek writing system: \p{greek} \p{script=greek} \p