w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
While Sending Html Mails from my web application Recieved Mails contains Symbols like &ldquo,&rdquo, ‘
Check with another constructor for htmlView: ContentType mimeType = new System.Net.Mime.ContentType("text/html"); var htmlView = AlternateView.CreateAlternateViewFromString(bodyMessage, mimeType);

Categories : Asp Net Mvc

regex to match until word but not include that keyword
Use positive forward lookahead: preg_match('/Message:(.*?)(?=Issue)/', 'Message: blah blah Issue', $matches); print_r($matches); prints Array ( [0] => Message: blah blah [1] => blah blah )

Categories : PHP

Validation(ASP.NET): If this attribute value is enclosed in quotation marks, the quotation marks must match
Try this: <asp:Label ID="CategoryText" CssClass='<%# Convert.ToBoolean(DataBinder.Eval(Container.DataItem, "IsSkipped")) ? "CategoryCell Skipped" : "CategoryCell" %>' runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "CategoryID").Equals(CurrentCategoryID) ? DataBinder.Eval(Container.DataItem, "Text").ToString() : GenerateQuestionURL(DataBinder.Eval(Container.DataItem, "CategoryID").ToString(), DataBinder.Eval(Container.DataItem, "Text").ToString()) %>' /> Its a bit of a mess though (hard to read), I would put this in a function and call it from there.

Categories : C#

Match sentences containing a given word
Based upon the information you have provided there are three permutations you need to cover. The word you are searching for is the first word in the sentence. In this case there will be no space before the word but there will be a space after the word. The word you are searching for is not the first word nor the last word in the sentence. In this case there will be a space either side of the word. The word you are searching for is the last word in the sentence. In this case there will be a space before the word but none after the word. So your query would look something like this ... SELECT * FROM YourTableName WHERE SentenceCol LIKE 'YOUR-SEARCH-WORD %' OR SentenceCol LIKE '% YOUR-SEARCH-WORD %' OR SentenceCol LIKE '% YOUR-SEARCH-WORD'

Categories : Sqlite

Quote marks in CSV file displayed in php file instead of wrapping field
The built in fgetcsv() function should handle any proper CSV format. It has parameters that let you change both the delimiter and the expected quote type. If the CSV isn't broken, this function should parse it fine. Try swapping it in for your own parser, tweak the params as necessary for your CSV format, and then loop over the resulting array instead. http://www.php.net/manual/en/function.fgetcsv.php

Categories : PHP

Regex Splitting Sentences into words
Square brackets denote a character class, round brackets a capturing group. Have a look at the Pattern class to see the predefined character classes. "[\s|\pPunct]+" // wrong "(\s|\p{Punct})+" // correct

Categories : Java

regex split text document into sentences
You have wrong regex. Java doesn't understand regex like this PCRE type regex: /(?<=[.?!])\S+(?=[a-z])/i Use this: String[] sentences = str.split("(?i)(?<=[.?!])\S+(?=[a-z])");

Categories : Java

Split POS tagged textvectors/factors into sentences with R - regex
Is this what you're after? # input r <- "Ich/PPER habe/VAFIN meinen/PPOSAT Berkeley/NN jetzt/ADV seit/APPR 11/CARD Jahren/NN im/APPRART fast/ADV täglichen/ADJA Einsatz/NN ./$. In/APPR der/ART Schule/NN und/KON im/APPRART Studium/NN war/VAFIN der/ART Rucksack/NN meistens/ADV bis/APPR zum/APPRART bersten/ADJA mit/APPR Büchern/NN gefüllt/VVPP ,/$, jetzt/ADV benutze/VVFIN ich/PPER das/ART gute/ADJA Stück/NN auf/APPR dem/ART Weg/NN zur/APPRART Arbeit/NN !/$. Das/ART Volumen/NN -LRB-/TRUNC 30/CARD Liter/NN -RRB-/TRUNC ist/VAFIN enorm/ADJD und/KON lässt/VVFIN sich/PRF ,/$, dank/APPR der/ART Form/NN ,/$, besonders/ADV für/APPR Bücher/NN und/KON Schreibutensilien/NN ideal/ADJD nutzen/VVINF ./$." # function to split sentences at commas, periods and other punctuation marks #

Categories : Regex

Python regex to print all sentences that contain two identified classes of markup
If I do not understand bad what you are trying to do is remove <emotion> </emotion> <LOCATION></LOCATION> ?? Well if is that what you want to do you can do this import re text = "Cello is a <emotion> wonderful </emotion> parakeet who lives in <LOCATION> Omaha </LOCATION>. He is the <emotion> best </emotion> singer I have ever heard." out = open('out.txt', 'w') def remove_xml_tags(xml): content = re.compile(r'<.*?>') return content.sub('', xml) data = remove_xml_tags(text) out.write(data + ' ') out.close()

Categories : Python

Words with single quote and `MATCH AGAINST` accuracy
I think this is in relation to your issue Full text query with a single quote I am almost certain dont or don't is a stopword.

Categories : Mysql

Regex unless inside "speech marks"
Description This regex will only find line with no quotes, or where quotes have white space between the quotes and it's payload. This expression assumes the first non space character would be the quote if it existed. If the first non space character is not the open quote then the entire line is allowed. ^s*(?:[^"].*|"s.*s"?)s*(?:$| | |) PHP Code Example: Input string slashdot " slashdot " " multiline 1 slashdot line 2 slashdot " "slashdot bad" " leading spaces and trailing spaces " Code <?php $sourcestring="your source string"; preg_match_all('/^(?:[^"].*|"s[^"]*s")/imx',$sourcestring,$matches); echo "<pre>".print_r($matches,true); ?> Matches $matches Array: ( [0] => Array ( [0] => sla

Categories : PHP

Python regex: find and replace commas between quotation marks
>>> import re >>> line = '12/08/2013,3,"9,25",42:51,"3,08","12,9","13,9",159,170,"3,19",437,' >>> re.sub(r'"(d+),(d+)"', r'1:2', line) '12/08/2013,3,9:25,42:51,3:08,12:9,13:9,159,170,3:19,437,' 1, 2 refer to matched groups. Non-regex solution: >>> ''.join(x if i % 2 == 0 else x.replace(',', ':') for i, x in enumerate(line.split('"'))) '12/08/2013,3,9:25,42:51,3:08,12:9,13:9,159,170,3:19,437,'

Categories : Python

RegEx Expression to find strings with quotation marks and a backslash
You didn't say which language you use, here's an example in Javascript: > s = 'say "hello" and replace "C:\folder\My File" thanks' "say "hello" and replace "C:folderMy File" thanks" > s.replace(/"([^"\]*\[^"]*)"/g, "$1") "say "hello" and replace C:folderMy File thanks"

Categories : Regex

REGEX: How to split string with space and double quote
You can use next regexp(see example): ("[^"]+")|S+ ("[^"]+") - quoted sequence. S+ - non whitespace sequence. Probably order of groups is depend from regexp implementation. In the demo engine matching stared from left to right. Also do not forget escape special characters with double slash.

Categories : Regex

Regex to match paths that don't match a specific pattern: Express Router
The following regex will match any path except those starting with /foo/ app.get(/^/([^f][^o][^o]|.{1,2}|.{4,})/.*$/, routes.index); I assume that this is a standard javascript regex.

Categories : Regex

Regex to match single new line. Regex to match double new line
To match exactly N repetitions of the same character you need lookaheads and lookbehinds (see Match exactly N repetitions of the same character). Since javascript doesn't support the latter, a pure regexp solution seems to be impossible. You'll have to use a helper function, for example: > x = "...a...aa...aaa...aaaa...a...aa" "...a...aa...aaa...aaaa...a...aa" > x.replace(/a+/g, function($0) { return $0.length == 2 ? '@@' : $0; }) "...a...@@...aaa...aaaa...a...@@"

Categories : Javascript

Regex to match only till first occurence of class match
You were missing ? Your regex would be (?i)(.*?)case[^a-zd]*(d+)(.*) You can toggle case insensitive match using (?i) in regex

Categories : Regex

Haskell - adding quotation marks (speech marks)
Do you mean, convert 7777 to a string? You can use show. show 7777 --> "7777" If you then want quotes around that string do: """ ++ show 7777 ++ """

Categories : Haskell

Regex that match if the match contains special word
You're kind of on the right track with lookahead assertions: {{START}}(?:(?!{{END}})[sS])*specialword(?:(?!{{END}})[sS])*{{END}} Explanation: {{START}} # Match {{START}} (?: # Match... (?!{{END}}) # ...as long as we haven't reached {{END}} yet: [sS] # any character )* # any number of times. specialword # Match "specialword" (?: # Match (as before)... (?!{{END}}) # whatever follows, unless it's {{END}} [sS] )* {{END}} # Then finally match {{END}}

Categories : Regex

Regex - Find the match that is inside a match
You can try this regex: /href=[^>]+.pdf/ regex101 demo Most of the time, when you can avoid .* or .+ (or their lazy versions), it's better :) Also, don't forget to escape periods.

Categories : PHP

Cannot read single quote and double quote character and some of the characters around it in PDFBOX
Possibly there is a more standard approach for extracting font from pdf, as described in the answer to this post: How to extract font styles of text contents using pdfbox? And basic text extraction is described in the pdfbox wiki: http://pdfbox.apache.org/cookbook/textextraction.html

Categories : Java

Getting error "String cannot be of zero length" when replacing a French quote character with normal single quote
It seems to me that, for some reason, your string at the point you attempt to replace is of 0 length. This indicates that the problem has to do with the contents of the column you retrieve from the DB. As such, I suggest that you check in your code if the string is null or empty before trying to replace.

Categories : C#

Fixing column "columnname" does not exist pgsql in database. Double quote vs single quote error
No you can't. If you had used proper insert - with named columns: insert into review (column1, column2, column3) values (....) then it could be theoretically possible to do by adding column "exist" and a trigger. But this would be very far away from being sane solution.

Categories : Postgresql

Java regex: need one regex to match all the formats specified
Try using a reluctant quantifier: _year:.*?s. .replaceAll("_year:.*?\s", "_year:Y ") System.out .println("utc-hour_of_year:2013-07-30T17 dsfsdgfsgf utc-week_of_year:2013-W31 dsfsdgfsdgf" .replaceAll("_year:.*?\s", "_year:Y ")); utc-hour_of_year:Y dsfsdgfsgf utc-week_of_year:Y dsfsdgfsdgf

Categories : Java

Prevent Quote Detail editing but allow the revision of the Quote itself
Register on the Pre Create message (stage 20) of QuoteDetail and filter on the parent context not being for Quote. If it is, just return (effectively doing nothing). The same applies to the Update message of the QuoteDetail. Both messages run in the context of the ReviseQuote message for Quote. var parentContext = context.ParentContext; // While there is a parent context... while (parentContext != null) { // When parent context is for "quote", return; if (parentContext.PrimaryEntityName == "quote") { return; } // Assign parent's parent context to loop parent context. parentContext = parentContext.ParentContext; }

Categories : C#

regex not returning match but there is clearly a match
You need to escape the dollar sign. start = '>$' end = '</td>' AnnualDiv = re.search('%s(.*)%s' % (start, end), s).group(1) The reason is that the $ is a special character in regex. (It matches the end of a string or before the newline.) This will set AnnualDiv to the string '0.48'. If you want to add the $, you can do it using this: AnnualDiv = "$%s" % re.search('%s(.*)%s' % (start, end), s).group(1)

Categories : Python

Regex.Match() won't match a substring
Try removing ^ and $: Regex regex = new Regex(@"[ABCEGHJKLMNPRSTVXY]{1}d{1}[A-Z]{1} *d{1}[A-Z]{1}d{1}", RegexOptions.None); ^ : The match must start at the beginning of the string or line. $ : The match must occur at the end of the string or before at the end of the line or string. If you want to match only in word boundaries you can use  as suggested by Mike Strobel: Regex regex = new Regex(@"[ABCEGHJKLMNPRSTVXY]{1}d{1}[A-Z]{1} *d{1}[A-Z]{1}d{1}", RegexOptions.None);

Categories : C#

php: how does single quote and double quote work together
PHP strings quoted with " characters interpolate variables and treat ' characters as literals. $name_bar is a string that contains ' characters. When it is interpolated, all the characters in it are placed where the variable was.

Categories : PHP

single quote or double quote in javascript
:contains("topic") this search for elements that contains "topic" string where as var topic = "community"; :contains(topic) topic here becomes "community"..so it searchs for element that contains "community"; well for this :contains("' + topic + '") i guess the code is incomplete.. $('div:contains("' + topic + '")')..; //div for example sake this becomes $('div:contains("community")')..; //<-- just to make sure the string is encoded with `""`

Categories : Javascript

Compile pattern quote inside quote
Escape your quotes: Pattern myPattern = Pattern.compile("<div class="thumb"><a href=(.*?)-t1"); Also, regex against HTML is usually considered to be bad practice.

Categories : Java

Javascript regex to match a regex
A regular expression to match a regular expression is //((?![*+?])(?:[^ [/\]|\.|[(?:[^ ]\]|\.)*])+)/((?:g(?:im?|mi?)?|i(?:gm?|mg?)?|m(?:gi?|ig?)?)?)/ To break it down, / matches a literal / (?![*+?]) is necessary because /* starts a comment, not a regular expression. [^ [/\] matches any non-escape sequence character and non-start of character group [...] matches a character group which can contain an un-escaped /. \. matches a prefix of an escape sequence + is necessary because // is a line comment, not a regular expression. (?:g...)? matches any combination of non-repeating regular expression flags. So ugly. This doesn't attempt to pair parentheses, or check that repetition modifiers are not applied to themselves, but filters out most of the other ways that regular expressions

Categories : Javascript

Looking for non-zero property TOs: Can I match a Description with number property, but use a regex match?
It is known that integer types has to be passed as integers in the description rendering the usage of regular expressions useless unfortunately. I do not have a QTP installation at hand right now, but to investigate it further, what happens if you use Print Browser("myBrowser").WebElement("height:=11").ChildObjects.Count and Print Browser("myBrowser").WebElement("height:=^[1-9][0-9]*$").ChildObjects.Count Where "myBrowser" is your browser definition of course.

Categories : Regex

Regular expression include the flags ignorecase and dot match all
Multiple flags can be specified by bitwise OR-ing them; re.I | re.M sets both the I and M flags, for example. so, bitwise-or the flags: str = "Test " a = re.findall(r"(d+)", str, re.IGNORECASE|re.S)

Categories : Python

Rails regex with include
Assuming mx is an Array: mx.any? { |server| server.exchange.to_s.downcase.include? "google" } Should work. As an aside, because the any? method returns true or false you don't need to explicitly return true, just return the value of the any? method. Example: [ "ASPMX.L.GOOGLE.com", "ALT1.ASPMX.L.GOOGLE.com", "ALT2.ASPMX.L.GOOGLE.com", "ASPMX2.GOOGLEMAIL.com", "ASPMX3.GOOGLEMAIL.com", "alt4.gmail-smtp-in.l.google.com", "alt3.gmail-smtp-in.l.google.com", "alt2.gmail-smtp-in.l.google.com", "gmail-smtp-in.l.google.com", "alt1.gmail-smtp-in.l.google.com" ] array.any? { |server| server.include? "google" } # => true array.any? { |server| server.downcase.include? "google" } # => true array.all? { |server| server.include? "google" } # => false array.all?

Categories : Ruby On Rails

how to include grep in a regex in perl
The easiest way is to define a quoted regular expression as your constant instead of a list: use strict; use warnings; use autodie; # Will kill program on bad opens, closes, and writes use feature qw(say); # Better than "print" in most situations use constant { LIST => qr/keyword1|keyword2|keyword3/, # Now a regular expression. FILE_READ => 'file.txt', # You're defining constants, make this one too. }; open my $read_fh, "<", FILE_READ; # Use scalars for file handles # This isn't Java. You don't have to define "main" subroutine while ( my $line = <$read_fh> ) { chomp $line; if ( $line =~ LIST ) { #Now I can use the constant as a regex say $line; } } close $read_fh; By the way, if you don't use autodie, the standard way of opening a file

Categories : Regex

How to include special chars in this regex
The following should work: ^(?=.*[a-z])(?=.*[0-9])(?=.*[^a-zA-Z0-9])[A-Z].{7,19}$ I removed the (?=.*[A-Z]) because the requirement that you must start with an uppercase character already covers that. I added (?=.*[^a-zA-Z0-9]) for the special characters, this will only match if there is at least one character that is not a letter or a digit. I also tweaked the length checking a little bit, the first step here was to remove the + after the [A-Z] so that we know exactly one character has been matched so far, and then changing the .{8,20} to .{7,19} (we can only match between 7 and 19 more characters if we already matched 1).

Categories : Regex

Regex Include/Except, Begins/Ends
String regex = "[01]*"; //all binary Strings including empty string, * == 0 or more String regex = "[01]+"; //all binary Strings except empty String, + == 1 or more String regex = "^1(?:.*1)?$"; // a string that begins and ends with 1. (?:exp) says group, but do not capture ^ beings with $ ends with ? 0 or 1 (?:.*1)? 0 or 1 of any series of characters ending in 1

Categories : Java

Javascript regex search until but do not include
Try look ahead like 'http://www.example.com/test/filter=show/results=true'.replace(//filter=.*?(?=/)/, '') Ex: var url = 'http://www.example.com/test/filter=show/results=true'; var param = 'filter'; var oldParam = '\/'+param+'=.*?(?=\/)'; console.log(oldParam) var reg = new RegExp(oldParam, "gi"); var result = url.replace(reg, ""); console.log(result) Demo: Fiddle

Categories : Javascript

Given regex does not match to the end
You need to pass the global modifier. I'm not sure which programming language you are using, but the syntax often resembles the following: /$myregex/g For example, given the following text: Hello Adam, how are you? Hello Sarah, how are you? The regular expression /Hellos(.*),/g will match both Adam and Sarah.

Categories : Python

Match BOL and EOL with std::regex
libstdc++ has no full support for regex (you can check it here). I'm tried to compile this code with clang 3.2 with libc++-3.2 and result is "true". Use libc++, or boost. Especially libstdc++ regex implementation status 8 Regular expressions 28.1 General N 28.2 Definitions N 28.3 Requirements N 28.4 Header <regex> synopsis N 28.5 Namespace std::regex_constants Y 28.6 Class regex_error Y 28.7 Class template regex_traits Partial 28.8 Class template basic_regex Partial 28.9 Class template sub_match Partial 28.10 Class template match_results Partial 28.11 Regular expression algorithms N 28.12 Regular expression Iterators N 28.13 Modified ECMAScript regular expression grammar N

Categories : C++



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.