Javascript Regex to find a exact match for a word begining with dot

In javascript, pattern \bvalue\b lists all "value" in exmaple following:

value is a property of textbox object. Using textbox.value, we can get or set value property of textbox.

\bvalue\b will return 3 matches for above string while I want to return 2 matches that don't have dot precede (textbox.value). What is useful pattern to solve my problem?

--------------Solutions-------------

One of the simplest solutions will be to match:

(^|\s)value(\s|$)

And use str.trim() on the resultant string.

See DEMO

This will give the matches that don't have a preceding dot.

\b(^|[^.])value\b

RegEx Demo

Category:javascript Time:2018-11-26 Views:2

Related post

  • How can I use regex for all words beginning with : punctuation? 2011-07-18

    How can I use regex for all words beginning with : punctuation? This gets all words beginning with a: \ba\w*\b The minute I change the letter a to :, the whole thing fails. Am I supposed to escape the colon, and if so, how? --------------Solutions---

  • Function to find the Exact match in MS SQL Server 2009-04-10

    What is the way to find the exactly matching substring in the given string in MS SQL server. For example, in this string '0000020354', I want to find '20354'. Of course it has to be exact match. I tried to use CHARINDEX(@providerId, external_prv_id)

  • GWT Mosaic Could not find an exact match rule-e 2011-08-29

    I'm using the gwt-mosaic 0.4.0-rc4. I have the following errors after a mvn gwt:compile : [INFO] --- gwt-maven-plugin:2.3.0-1:compile (default) @ ... --- [INFO] auto discovered modules [...] [WARNING] Don't declare gwt-dev as a project dependency. Th

  • Finding closest match for latitude and longitude with hibernate 2011-04-24

    Lets say I get the user to pick long and lat on map. I have database with following fields: zip state latitude longitude city full_state How do I retrieve the closest match for long and lat with hibernate HQL queary? --------------Solutions----------

  • Unable to find the exact driver for Avermedia Volar HD Max 2015-01-17

    I cannot get my Avermedia Volar HD Max usb tuner to work in Windows 8 Media Center. Where can I find drivers? --------------Solutions------------- Hi, Thank you for using Windows 8. I will help you to find a resolution regarding the Avermedia Volar H

  • Mule ESB error >> "There are two transformers that are an exact match for input 2018-03-09

    I am a newbie in Mule. I try to create a simple login flow with SOAP that will return XML Response. My method is send the data with XML and then i save the login data in the transformation code, after save the data, the return data will be generated

  • How to use python regex to match words beginning with hash and question mark? 2010-01-03

    This should be easy and this regex works fine to search for words beginning with specific characters, but I can't get it to match hashes and question marks. This works and matches words beginning a: r = re.compile(r"\b([a])(\w+)\b") But these don't m

  • RegEx help - find substring except when in specific word(s) 2011-06-24

    A colleague is scanning a large script looking for the substring UAT (case insensitive). Unfortunately, the script contains many references to "valuation", either as a whole word or as part of a field name. What RegEx search pattern would return matc

  • VBA for finding all words beginning with § and transfering them in Excel 2012-12-06

    My aim is to (1) find in the Word document all words beginning with §-character (it can appear in the beginning only), and fill them in a string array, (2) transfer this array for the next treatment into Excel app. Being expert in Excel VBA, I’m lost

  • How do I get Vim to match a line not beginning with a seven-digit number? 2009-09-21

    I have a file with about 1000 lines. All lines begin with a seven-digit number except for the occasional line. I need to catch these lines and actually join them with the previous line. I've managed to be able to match any line that begins with a sev

  • Using regex to find an exact pattern match in Ruby 2011-07-15

    How would I go about testing for an exact match using regex. "car".match(/[ca]+/) returns true. How would I get the above statement to return false since the regex pattern doesn't contain an "r"? Any string that contains any characters other than "c"

  • Regex to get all possible matches for a pattern in C# 2009-03-12

    I'm learning regex and need some help to get all possible matches for a pattern out of a string. If my input is: case a when cond1 then stmt1; when cond2 then stmt2; end case; I need to get the matches which have groups as follows Group1: "cond1" "st

  • Javascript regex to find words that do not start with "my:" 2013-07-19

    I'm trying to write a regex that will find all values between curly braces that do not begin with "my:". For example, I want to capture {this} but not {my:monkey}. The pattern that captures everything is: \{([^\}]*)\} I'm having trouble getting it to

  • How to find best fuzzy match for a string in a large string database 2008-11-21

    I have a database of strings (arbitrary length) which holds more than one million items (potentially more). I need to compare a user-provided string against the whole database and retrieve an identical string if it exists or otherwise return the clos

  • Finding a loose match for a string in arraylist 2010-06-28

    I have a huge array list which contains 1000 entries out of which one of the entry is "world". And, I have a word "big world". I want to get the word "big world" matched with "world" in the arraylist. What is the most cost effective way of doing it?

  • Javascript RegExp - how do I match for a word, but not if another word is also present? 2011-08-19

    I am testing a string against a series of regular expressions. Most of these are simple - often just testing if a single word appears in the string like so var str = 'Blah blah foo blah'; var my_array = [ { test: 'foo', name: 'foo_ame' }, { test: 'ba

  • How do I match for symbols like < and > with regex in Python? 2012-02-25

    I am parsing a log file, and I am trying to match for expressions like "key"=>"value" to extract the value. I can't figure out how to match for the greater than symbol. I am not having any luck with re.match(r">", ...), r"\>", or r"\\r". How

  • SQL query question - finding an exact match 2013-11-12

    I'm using SQL to query an Access database for cost centers. We have to cost centers, 1A and 1a, and I'm trying to retrieve the records for each one separately with the following code: SELECT [tablename].* FROM [tablename] WHERE ((([tablename].fieldna

  • Regex to match a word beginning with a period and ending with an underscore? 2014-03-05

    I'm quite the Regex novice, but I have a series of strings similar to this "[$myVar.myVar_STATE]" I need to replace the 2nd myVar that begins with a period and ends with an underscore. I need it to match it exactly, as sometimes I'll have "[$myVar.my

Copyright (C) pcaskme.com, All Rights Reserved.

processed in 0.610 (s). 13 q(s)