word-boundary Questions

6

Solved

Since str_replace() matches :Name two times in :Name :Name_en, I want to match the results for the whole word only. I wanted to switch to preg_replace() because of this answer. $str = ":Name :...
Nutt asked 13/3, 2012 at 10:53

8

Solved

I have a regex expression that I'm using to find all the words in a given block of content, case insensitive, that are contained in a glossary stored in a database. Here's my pattern: /($word)/i ...
Tajo asked 17/11, 2009 at 19:49

7

Solved

For example, in this text: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc eu tellus vel nunc pretium lacinia. Proin sed lorem. Cras sed ipsum. Nunc a libero quis risus sollicitudi...
Preventive asked 13/2, 2009 at 14:52

3

Solved

I'm using regex word boundary \b, and I'm trying to match foo in the following $sentence but the result is not what I need, the underscore is killing me, I want underscore to be word boundary just ...
Blount asked 16/3, 2015 at 2:15

1

Solved

Consider the string "abc를". According to unicode's demo implementation of word segmentation, this string should be split into two words, "abc" and "를". However, 3 diff...
Brew asked 6/2, 2021 at 20:17

13

Solved

I'm trying to use regexes to match space-separated numbers. I can't find a precise definition of \b ("word boundary"). I had assumed that -12 would be an "integer word" (matched...
Cooney asked 24/8, 2009 at 20:46

2

Solved

Is there an equivalent when using str.contains? the following code is mistakenly listing "Said Business School" in the category because of 'Sa.' If I could create a wordboundary it would solve th...
Jackelinejackelyn asked 12/3, 2014 at 17:57

4

Solved

I'm trying to match some whole-word-expressions with the MySQL REGEXP function. There is a problem, when there are double quotes involved. The MySQL documentation says: "To use a literal instance ...
Bargain asked 19/9, 2013 at 17:52

4

Solved

I would like to replace just complete words using php Example : If I have $text = "Hello hellol hello, Helloz"; and I use $newtext = str_replace("Hello",'NEW',$text); The new text sho...
Unfriended asked 6/8, 2010 at 17:37

3

Solved

I am having a problem with matching word boundaries with REGEXP_LIKE. The following query returns a single row, as expected. select 1 from dual where regexp_like('DOES TEST WORK HERE','TEST'); B...
Gathering asked 27/9, 2011 at 10:32

3

I want to add word boundaries to this awk command: awk '{$0=tolower($0)};/wordA/&&/wordB/ { print FILENAME ":" $0; }' myfile.txt I tried adding \y at left and right of wordA and wordB b...
Neela asked 13/3, 2012 at 0:44

4

Solved

I need to find repeated words in a file using egrep (or grep -e) in unix (bash) I tried: egrep "(\<[a-zA-Z]+\>) \1" file.txt and egrep "(\b[a-zA-Z]+\b) \1" file.txt but for some reason...
Rootlet asked 28/10, 2015 at 16:37

4

Solved

I have the following php code in a utf-8 php file: var_dump(setlocale(LC_CTYPE, 'de_DE.utf8', 'German_Germany.utf-8', 'de_DE', 'german')); var_dump(mb_internal_encoding()); var_dump(mb_internal_en...
Virgina asked 12/3, 2010 at 13:8

1

Solved

import re sstring = "ON Any ON Any" regex1 = re.compile(r''' \bON\bANY\b''', re.VERBOSE) regex2 = re.compile(r'''\b(ON)?\b(Any)?''', re.VERBOSE) regex3 = re.compile(r'''\b(?:ON)?\b(?:Any)?''', re.V...
Plasterboard asked 5/10, 2016 at 13:41

1

Solved

Javascript's regex syntax only has one word boundary: \b. Vim's regex syntax has two: \< (start of word) and \> (end of word). Can anyone give me an example of a search that can be achieved...
Pires asked 5/11, 2015 at 8:16

1

I am aware that the issue involving the dollar sign "$" in regex (here: either in PHP and JavaScript) has been discussed numerous times before: Yes, I know that I need to add a backslash "\" in fro...
Nationwide asked 30/9, 2015 at 17:0

1

Solved

Simply put: echo "xxxxx Tyyy zzzzz" | egrep "\byyy\b" (no match which is correct) echo "xxxxx T-yyy zzzzz" | egrep "\byyy\b" xxxxx T-yyy zzzzz I dont want it to match like it does in the se...
Somnus asked 3/9, 2015 at 15:56

2

Solved

What are non-word boundary in regex (\B), compared to word-boundary?
Attitudinarian asked 27/12, 2010 at 20:25

3

Solved

Does PostgreSQL support \b? I'm trying \bAB\b but it doesn't match anything, whereas (\W|^)AB(\W|$) does. These 2 expressions are essentially the same, aren't they?
Shona asked 29/9, 2010 at 20:41

1

Solved

I would like to achieve the following (a full text search), SELECT * FROM tablename where columnname REGEXP '[[:<:]]some string[[:>:]]' Where i am interested in only exact strings (not jus...
Nakamura asked 30/1, 2015 at 3:11

2

Solved

string = c("apple", "apples", "applez") grep("apple", string) This would give me the index for all three elements in string. But I want an exact match on the word "apple" (i.e I just want grep() ...
Bhakti asked 8/11, 2014 at 4:15

2

Solved

I have a regular expression using word boundaries that works exceedingly well... ~\b('.$value.')\b~i ...save for the fact that it matches text inside HTML tags (i.e. title="This is blue!"). It's ...
Permissible asked 17/6, 2013 at 6:13

3

Solved

I have a difficulty using \b and greek characters in a regex. At this example [a-zA-ZΆΈ-ώἀ-ῼ]* succeeds to mark all the words I want (both greek and english). Now consider that I want to find word...
Entrails asked 4/5, 2014 at 16:50

2

Solved

I'm trying to use a Regex pattern (in Java) to find a sequence of 3 digits and only 3 digits in a row. 4 digits doesn't match, 2 digits doesn't match. The obvious pattern to me was: "\b(\d{3})\b"...
Dolor asked 10/4, 2014 at 16:17

1

Solved

Hi I have the following code which is meant to find the word "is" but not when it is within another string so the word "this" should not return a match so I use \b. But the following code does not ...
Honour asked 27/1, 2014 at 19:27

© 2022 - 2024 — McMap. All rights reserved.