Search Results

Search found 6715 results on 269 pages for 'preg match'.

Page 13/269 | < Previous Page | 9 10 11 12 13 14 15 16 17 18 19 20  | Next Page >

  • Multiple LIKE, OR MySql Queries Match

    - by Codex73
    Search for: 'chemist' Problem: query which will match a string like 'onechemist' but not 'chemist'. SELECT id,name FROM `records` WHERE name LIKE '%". mysql_real_escape_string($q) ."%' This alternate try won't work: SELECT id,name FROM `records` WHERE name LIKE '%". mysql_real_escape_string($q) ."%' OR name LIKE '". mysql_real_escape_string($q) ."%' OR name LIKE '%". mysql_real_escape_string($q) ."' How could I compile the above into one single query that will match any field which has the string or optimize the query into a better expression?

    Read the article

  • How to match data between columns to do the comparasion

    - by NCC
    I do not really know how to explain this in a clear manner. Please see attached image I have a table with 4 different columns, 2 are identical to each other (NAME and QTY). The goal is to compare the differences between the QTY, however, in order to do it. I must: 1. sort the data 2. match the data item by item This is not a big deal with small table but with 10 thousand rows, it takes me a few days to do it. Pleas help me, I appreciate. My logic is: 1. Sorted the first two columns (NAME and QTY) 2. For each value of second two columns (NAME and QTY), check if it match with first two column. If true, the insert the value. 3. For values are not matched, insert to new rows with offset from the rows that are in first two columns but not in second two columns

    Read the article

  • F# match char values

    - by rwallace
    I'm trying to match an integer expression against character literals, and the compiler complains about type mismatch. let rec read file includepath = let ch = ref 0 let token = ref 0 use stream = File.OpenText file let readch() = ch := stream.Read() let lex() = match !ch with | '!' -> readch() | _ -> token := !ch ch has to be an int because that's what stream.Read returns in order to use -1 as end of file marker. If I replace '!' with int '!' it still doesn't work. What's the best way to do this?

    Read the article

  • RegExp to match fraction

    - by user3627265
    I'm trying to perform regex to match a fraction. The user will input a fraction eg., 1/4, 1 1/2 10/2 so on. I have tested this regex and it works, but the problem is when I type in 10, 20, 30, 40 so on It does not recognized these values. This is my regex As you can see, it first sorted out the integer and then the slash and lastly the integer after the slash. var check_zero_value = str1.match(/[1-9]\/[1-9]/g); if(!check_zero_value1) { return false; } Any idea on this?

    Read the article

  • Plan Caching and Query Memory Part II (Hash Match) – When not to use stored procedure - Most common performance mistake SQL Server developers make.

    - by sqlworkshops
    SQL Server estimates Memory requirement at compile time, when stored procedure or other plan caching mechanisms like sp_executesql or prepared statement are used, the memory requirement is estimated based on first set of execution parameters. This is a common reason for spill over tempdb and hence poor performance. Common memory allocating queries are that perform Sort and do Hash Match operations like Hash Join or Hash Aggregation or Hash Union. This article covers Hash Match operations with examples. It is recommended to read Plan Caching and Query Memory Part I before this article which covers an introduction and Query memory for Sort. In most cases it is cheaper to pay for the compilation cost of dynamic queries than huge cost for spill over tempdb, unless memory requirement for a query does not change significantly based on predicates.   This article covers underestimation / overestimation of memory for Hash Match operation. Plan Caching and Query Memory Part I covers underestimation / overestimation for Sort. It is important to note that underestimation of memory for Sort and Hash Match operations lead to spill over tempdb and hence negatively impact performance. Overestimation of memory affects the memory needs of other concurrently executing queries. In addition, it is important to note, with Hash Match operations, overestimation of memory can actually lead to poor performance.   To read additional articles I wrote click here.   The best way to learn is to practice. To create the below tables and reproduce the behavior, join the mailing list by using this link: www.sqlworkshops.com/ml and I will send you the table creation script. Most of these concepts are also covered in our webcasts: www.sqlworkshops.com/webcasts  Let’s create a Customer’s State table that has 99% of customers in NY and the rest 1% in WA.Customers table used in Part I of this article is also used here.To observe Hash Warning, enable 'Hash Warning' in SQL Profiler under Events 'Errors and Warnings'. --Example provided by www.sqlworkshops.com drop table CustomersState go create table CustomersState (CustomerID int primary key, Address char(200), State char(2)) go insert into CustomersState (CustomerID, Address) select CustomerID, 'Address' from Customers update CustomersState set State = 'NY' where CustomerID % 100 != 1 update CustomersState set State = 'WA' where CustomerID % 100 = 1 go update statistics CustomersState with fullscan go   Let’s create a stored procedure that joins customers with CustomersState table with a predicate on State. --Example provided by www.sqlworkshops.com create proc CustomersByState @State char(2) as begin declare @CustomerID int select @CustomerID = e.CustomerID from Customers e inner join CustomersState es on (e.CustomerID = es.CustomerID) where es.State = @State option (maxdop 1) end go  Let’s execute the stored procedure first with parameter value ‘WA’ – which will select 1% of data. set statistics time on go --Example provided by www.sqlworkshops.com exec CustomersByState 'WA' goThe stored procedure took 294 ms to complete.  The stored procedure was granted 6704 KB based on 8000 rows being estimated.  The estimated number of rows, 8000 is similar to actual number of rows 8000 and hence the memory estimation should be ok.  There was no Hash Warning in SQL Profiler. To observe Hash Warning, enable 'Hash Warning' in SQL Profiler under Events 'Errors and Warnings'.   Now let’s execute the stored procedure with parameter value ‘NY’ – which will select 99% of data. -Example provided by www.sqlworkshops.com exec CustomersByState 'NY' go  The stored procedure took 2922 ms to complete.   The stored procedure was granted 6704 KB based on 8000 rows being estimated.    The estimated number of rows, 8000 is way different from the actual number of rows 792000 because the estimation is based on the first set of parameter value supplied to the stored procedure which is ‘WA’ in our case. This underestimation will lead to spill over tempdb, resulting in poor performance.   There was Hash Warning (Recursion) in SQL Profiler. To observe Hash Warning, enable 'Hash Warning' in SQL Profiler under Events 'Errors and Warnings'.   Let’s recompile the stored procedure and then let’s first execute the stored procedure with parameter value ‘NY’.  In a production instance it is not advisable to use sp_recompile instead one should use DBCC FREEPROCCACHE (plan_handle). This is due to locking issues involved with sp_recompile, refer to our webcasts, www.sqlworkshops.com/webcasts for further details.   exec sp_recompile CustomersByState go --Example provided by www.sqlworkshops.com exec CustomersByState 'NY' go  Now the stored procedure took only 1046 ms instead of 2922 ms.   The stored procedure was granted 146752 KB of memory. The estimated number of rows, 792000 is similar to actual number of rows of 792000. Better performance of this stored procedure execution is due to better estimation of memory and avoiding spill over tempdb.   There was no Hash Warning in SQL Profiler.   Now let’s execute the stored procedure with parameter value ‘WA’. --Example provided by www.sqlworkshops.com exec CustomersByState 'WA' go  The stored procedure took 351 ms to complete, higher than the previous execution time of 294 ms.    This stored procedure was granted more memory (146752 KB) than necessary (6704 KB) based on parameter value ‘NY’ for estimation (792000 rows) instead of parameter value ‘WA’ for estimation (8000 rows). This is because the estimation is based on the first set of parameter value supplied to the stored procedure which is ‘NY’ in this case. This overestimation leads to poor performance of this Hash Match operation, it might also affect the performance of other concurrently executing queries requiring memory and hence overestimation is not recommended.     The estimated number of rows, 792000 is much more than the actual number of rows of 8000.  Intermediate Summary: This issue can be avoided by not caching the plan for memory allocating queries. Other possibility is to use recompile hint or optimize for hint to allocate memory for predefined data range.Let’s recreate the stored procedure with recompile hint. --Example provided by www.sqlworkshops.com drop proc CustomersByState go create proc CustomersByState @State char(2) as begin declare @CustomerID int select @CustomerID = e.CustomerID from Customers e inner join CustomersState es on (e.CustomerID = es.CustomerID) where es.State = @State option (maxdop 1, recompile) end go  Let’s execute the stored procedure initially with parameter value ‘WA’ and then with parameter value ‘NY’. --Example provided by www.sqlworkshops.com exec CustomersByState 'WA' go exec CustomersByState 'NY' go  The stored procedure took 297 ms and 1102 ms in line with previous optimal execution times.   The stored procedure with parameter value ‘WA’ has good estimation like before.   Estimated number of rows of 8000 is similar to actual number of rows of 8000.   The stored procedure with parameter value ‘NY’ also has good estimation and memory grant like before because the stored procedure was recompiled with current set of parameter values.  Estimated number of rows of 792000 is similar to actual number of rows of 792000.    The compilation time and compilation CPU of 1 ms is not expensive in this case compared to the performance benefit.   There was no Hash Warning in SQL Profiler.   Let’s recreate the stored procedure with optimize for hint of ‘NY’. --Example provided by www.sqlworkshops.com drop proc CustomersByState go create proc CustomersByState @State char(2) as begin declare @CustomerID int select @CustomerID = e.CustomerID from Customers e inner join CustomersState es on (e.CustomerID = es.CustomerID) where es.State = @State option (maxdop 1, optimize for (@State = 'NY')) end go  Let’s execute the stored procedure initially with parameter value ‘WA’ and then with parameter value ‘NY’. --Example provided by www.sqlworkshops.com exec CustomersByState 'WA' go exec CustomersByState 'NY' go  The stored procedure took 353 ms with parameter value ‘WA’, this is much slower than the optimal execution time of 294 ms we observed previously. This is because of overestimation of memory. The stored procedure with parameter value ‘NY’ has optimal execution time like before.   The stored procedure with parameter value ‘WA’ has overestimation of rows because of optimize for hint value of ‘NY’.   Unlike before, more memory was estimated to this stored procedure based on optimize for hint value ‘NY’.    The stored procedure with parameter value ‘NY’ has good estimation because of optimize for hint value of ‘NY’. Estimated number of rows of 792000 is similar to actual number of rows of 792000.   Optimal amount memory was estimated to this stored procedure based on optimize for hint value ‘NY’.   There was no Hash Warning in SQL Profiler.   This article covers underestimation / overestimation of memory for Hash Match operation. Plan Caching and Query Memory Part I covers underestimation / overestimation for Sort. It is important to note that underestimation of memory for Sort and Hash Match operations lead to spill over tempdb and hence negatively impact performance. Overestimation of memory affects the memory needs of other concurrently executing queries. In addition, it is important to note, with Hash Match operations, overestimation of memory can actually lead to poor performance.   Summary: Cached plan might lead to underestimation or overestimation of memory because the memory is estimated based on first set of execution parameters. It is recommended not to cache the plan if the amount of memory required to execute the stored procedure has a wide range of possibilities. One can mitigate this by using recompile hint, but that will lead to compilation overhead. However, in most cases it might be ok to pay for compilation rather than spilling sort over tempdb which could be very expensive compared to compilation cost. The other possibility is to use optimize for hint, but in case one sorts more data than hinted by optimize for hint, this will still lead to spill. On the other side there is also the possibility of overestimation leading to unnecessary memory issues for other concurrently executing queries. In case of Hash Match operations, this overestimation of memory might lead to poor performance. When the values used in optimize for hint are archived from the database, the estimation will be wrong leading to worst performance, so one has to exercise caution before using optimize for hint, recompile hint is better in this case.   I explain these concepts with detailed examples in my webcasts (www.sqlworkshops.com/webcasts), I recommend you to watch them. The best way to learn is to practice. To create the above tables and reproduce the behavior, join the mailing list at www.sqlworkshops.com/ml and I will send you the relevant SQL Scripts.  Register for the upcoming 3 Day Level 400 Microsoft SQL Server 2008 and SQL Server 2005 Performance Monitoring & Tuning Hands-on Workshop in London, United Kingdom during March 15-17, 2011, click here to register / Microsoft UK TechNet.These are hands-on workshops with a maximum of 12 participants and not lectures. For consulting engagements click here.   Disclaimer and copyright information:This article refers to organizations and products that may be the trademarks or registered trademarks of their various owners. Copyright of this article belongs to R Meyyappan / www.sqlworkshops.com. You may freely use the ideas and concepts discussed in this article with acknowledgement (www.sqlworkshops.com), but you may not claim any of it as your own work. This article is for informational purposes only; you use any of the suggestions given here entirely at your own risk.   R Meyyappan [email protected] LinkedIn: http://at.linkedin.com/in/rmeyyappan

    Read the article

  • preg_match problem

    - by Biroka
    I'm trying to get some stuff from a string in php. In RegexBuddy and Regular expression tester (firefox addon) it works good, but php gives me the following: Warning: preg_match() [function.preg-match]: Compilation failed: unmatched parentheses at offset 34 in D:\path\example.php on line 62 my pattern is "/.{4}_tmp\\([A-Za-z0-9.\\]*)\(([0-9]*)\) : (.*)/i" an example string: C:\Temp\browseide\projects\32\821C_tmp\SourceFiles\main.c(8) : error C2143: syntax error : missing ';' before 'for' what RegexBuddy gets: 821C_tmp\SourceFiles\main.c(8) : error C2143: syntax error : missing ';' before 'for' Group 1: SourceFiles\main.c Group 2: 8 Group 3: error C2143: syntax error : missing ';' before 'for'

    Read the article

  • Buggy Perl regular expression

    - by Tichomir Mitkov
    Hi, there I'm writing a program that has to get values from a file. In the file each line indicates an entity. Each entity has three values. For example: Value1 Value2 value3 I have a regular expresion to match them m/(.*?) (.*?) (.*?)/m; But it seems that the third value in never matched! The only way to match the third value is to add another value in the file and another "matching brackets" in the expresion. But this does not satisfy me. Thanks in Advance!

    Read the article

  • Regular Expression issue

    - by Christian Sciberras
    I have the following URL structure which I need to match to and get the particular id from: /group/subgroup/id-name In short, I need to translate a URL like the following: /Blue Products/Dark Blue/5-Blue_Jelly To: /?pagename=Blue Products&model=5 IMPORTANT: I don't need to match group, I already have group. Example code: <?php foreach($cats as $cat) $cmd->rewrite('/\/'.$cat.'\/unused\/(ID)-unused\//','/?pagename='.$cat.'&model=%ID%'); ?> Edit: This is the completed code: if($groups->count()){ $names=array(); foreach($groups->rows as $row) $names[]=preg_quote($row->group); $names=implode('|',$names); $regex='('.$names.')/([^/]+)/([0-9]{1,})-([^/]+)/?$'; CmsHost::cms()->rewrite_url($regex,'index.php?pagename=Products',true); }

    Read the article

  • preg_replace only replaces first occurrence then skips to next line

    - by Dom
    Got a problem where preg_replace only replaces the first match it finds then jumps to the next line and skips the remaining parts on the same line that I also want to be replaced. What I do is that I read a CSS file that sometimes have multiple "url(media/pic.gif)" on a row and replace "media/pic.gif" (the file is then saved as a copy with the replaced parts). The content of the CSS file is put into the variable $resource_content: $resource_content = preg_replace('#(url\((\'|")?)(.*)((\'|")?\))#i', '${1}'.url::base(FALSE).'${3}'.'${4}', $resource_content); Does anyone know a solution for why it only replaces the first match per line?

    Read the article

  • Searching within an array of strings...

    - by SoLoGHoST
    Ok, I'm feeling retarded here, I have a string like so: $string = 'function module_testing{'; or it could be like this: $string = 'function module_testing'; And than I have an array of strings like so: $string_array = array('module_testing', 'another_function', 'and_another_function'); Now, is there some sort of preg_match that I can do to test if any of the $string_array values are found within the $string string at any given position? So in this situation, there would be a match. Or is there a better way to do this? I can't use in_array since it's not an exact match, and I'd rather not do a foreach loop on it if I can help it, since it's already in a while loop. Thanks :)

    Read the article

  • XSL match some but not all

    - by Willb
    I have a solution from an earlier post that was kindly provided by Dimitre Novatchev. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:my="my:my"> <xsl:output method="xml" version="1.0" encoding="iso-8859-1" indent="yes"/> <xsl:key name="kPhysByName" match="KB_XMod_Modules" use="Physician"/> <xsl:template match="/"> <result> <xsl:apply-templates/> </result> </xsl:template> <xsl:template match="/*/*/*[starts-with(name(), 'InfBy')]"> <xsl:variable name="vCur" select="."/> <xsl:for-each select="document('doc2.xml')"> <xsl:variable name="vMod" select="key('kPhysByName', $vCur)"/> <xsl:copy> <items> <item> <label> <xsl:value-of select="$vMod/Physician"/> </label> <value> <xsl:value-of select="$vMod/XModID"/> </value> </item> </items> </xsl:copy> </xsl:for-each> </xsl:template> </xsl:stylesheet> I now need to use additional fields in my source XML and need the existing labels intact but I'm having problems getting this going. <instance> <NewTag>Hello</newTag1> <AnotherNewTag>Everyone</AnotherNewTag> <InfBy1>Dr Phibes</InfBy1> <InfBy2>Dr X</InfBy2> <InfBy3>Dr Chivago</InfBy3> </instance> It drops the additional labels and outputs <result xmlns:my="my:my"> HelloEveryone <items> <item> <label>Dr Phibes</label> <value>60</value> </item> </items> ... I've been experimenting a lot with <xsl:otherwise> <xsl:copy-of select="."> </xsl:copy-of> </xsl:otherwise> but being an xsl newbie I can't seem to get this to work. I've a feeling I'm barking up the wrong tree! Does anyone have any ideas? Thanks, Will

    Read the article

  • PHP getting a bunch of weird code \u0644\u064a\u0646\u0643 \u0627\u0644

    - by Webby
    Hello I'm getting a bunch of weird html output in users messages e.g. \u0644\u064a\u0646\u0643 \u0627\u0644 \u0639\u0627\u0645\u0644 I assume their aribic characters decoded? How can I perhaps preg replace all these codes with something a little more useful? because search results are filled with pages and pages of this stuff Perhaps even display them as they're supposed to be? Any advice what to do with such strings and how to implement them appreciated.. Please keep in mind this stuff is mixed in been common language letters / numbers many thanks

    Read the article

  • Correct syntax for matching a string inside a variable against an array

    - by Jamex
    Hi, I have a variable, $var, that contains a string of characters, this is a dynamic variable that contains the values from inputs. $var could be 'abc', or $var could be 'blu', I want to match the string inside variable against an array, and return all the matches. $array = array("blue", "red", "green"); What is the correct syntax for writing the code in php, my rough code is below $match = preg_grep($var, $array); (incorrect syntax of course) I tried to put quotes and escape slashes, but so far no luck. Any suggestion? TIA

    Read the article

  • Test/expand my email regex

    - by Ross
    I'm really not confident with Regex, I know some basic syntax but not enough to keep me happy. I'm trying to build a regular expression to check if an email is valid. So far here's what I've got: [A-Za-z0-9._-]+@[A-Za-z0-9]+.[A-Za-z.]+ It needs to take account of periods in the username/domain and I think it works with multiple TLDs (e.g. co.uk). I'm working with the preg engine in PHP so it needs to work with that. Thanks if you can help!

    Read the article

  • php regex to split invoice line item description

    - by user1053700
    I am attempting to split strings like the following: An item (Item A) which may contain 89798 numbers and letters @ $550.00 4 of Item B @ $420.00 476584 of Item C, with a larger quantity and different currency symbol @ £420.00 into: array( 0 => 1 1 => "some item which may contain 89798 numbers and letters" 2 => $550.00 ); does that make sense? I am looking for a regex pattern which will split the quantity, description, and price (including symbol). the strings will always be: qty x description @ price+symbol so i assume the regex would be something like: `(match a number and only a number) x (get description letters and numbers before the @ symbol) @ (match the currency symbol and price)` How should I approach this?

    Read the article

  • How to get all captures of subgroup matches with preg_match_all()?

    - by hakre
    Update/Note: I think what I'm probably looking for is to get the captures of a group in PHP. Referenced: PCRE regular expressions using named pattern subroutines. (Read carefully:) I have a string that contains a variable number of segments (simplified): $subject = 'AA BB DD '; // could be 'AA BB DD CC EE ' as well I would like now to match the segments and return them via the matches array: $pattern = '/^(([a-z]+) )+$/i'; $result = preg_match_all($pattern, $subject, $matches); This will only return the last match for the capture group 2: DD. Is there a way that I can retrieve all subpattern captures (AA, BB, DD) with one regex execution? Isn't preg_match_all suitable for this? This question is a generalization. Both the $subject and $pattern are simplified. Naturally with such the general list of AA, BB, .. is much more easy to extract with other functions (e.g. explode) or with a variation of the $pattern. But I'm specifically asking how to return all of the subgroup matches with the preg_...-family of functions. For a real life case imagine you have multiple (nested) level of a variant amount of subpattern matches. Example This is an example in pseudo code to describe a bit of the background. Imagine the following: Regular definitions of tokens: CHARS := [a-z]+ PUNCT := [.,!?] WS := [ ] $subject get's tokenized based on these. The tokenization is stored inside an array of tokens (type, offset, ...). That array is then transformed into a string, containing one character per token: CHARS -> "c" PUNCT -> "p" WS -> "s" So that it's now possible to run regular expressions based on tokens (and not character classes etc.) on the token stream string index. E.g. regex: (cs)?cp to express one or more group of chars followed by a punctuation. As I now can express self-defined tokens as regex, the next step was to build the grammar. This is only an example, this is sort of ABNF style: words = word | (word space)+ word word = CHARS+ space = WS punctuation = PUNCT If I now compile the grammar for words into a (token) regex I would like to have naturally all subgroup matches of each word. words = (CHARS+) | ( (CHARS+) WS )+ (CHARS+) # words resolved to tokens words = (c+)|((c+)s)+c+ # words resolved to regex I could code until this point. Then I ran into the problem that the sub-group matches did only contain their last match. So I have the option to either create an automata for the grammar on my own (which I would like to prevent to keep the grammar expressions generic) or to somewhat make preg_match working for me somehow so I can spare that. That's basically all. Probably now it's understandable why I simplified the question. Related: pcrepattern man page Get repeated matches with preg_match_all()

    Read the article

  • Load big XML files to mySQL database (PHP)

    - by Kees
    Hello There, For a new project I need to load big XML files (200MB+) to a mySQL database. There are +- 20 feeds i need to match with that (not all fields are the same). Now when i want to catch the XML I get this error: Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 171296569 bytes) in E:\UsbWebserver\Root\****\application\libraries\MY_xml.php on line 21 Is there an easy solution for this? It's not possible to get te feed in parts of a few MB's each. Thank you very much! P.s. has somebody an idea to match xml-feeds easy?

    Read the article

  • [MySQL] Optimize Query

    - by bordeux
    Hello. I have problem with optimize this query: SET @SEARCH = "dokumentalne"; SELECT SQL_NO_CACHE `AA`.`version` AS `Version` , `AA`.`contents` AS `Contents` , `AA`.`idarticle` AS `AdressInSQL` , `AA` .`topic` AS `Topic` , MATCH (`AA`.`topic` , `AA`.`contents`) AGAINST (@SEARCH) AS `Relevance` , `IA`.`url` AS `URL` FROM `xv_article` AS `AA` INNER JOIN `xv_articleindex` AS `IA` ON ( `AA`.`idarticle` = `IA`.`adressinsql` ) INNER JOIN ( SELECT `idarticle` , MAX( `version` ) AS `version` FROM `xv_article` WHERE MATCH (`topic` , `contents`) AGAINST (@SEARCH) GROUP BY `idarticle` ) AS `MG` ON ( `AA`.`idarticle` = `MG`.`idarticle` ) WHERE `IA`.`accepted` = "yes" AND `AA`.`version` = `MG`.`version` ORDER BY `Relevance` DESC LIMIT 0 , 30 Now, this query using ^ 20 seconds. How to optimize this? EXPLAIN gives this: 1 PRIMARY AA ALL NULL NULL NULL NULL 11169 Using temporary; Using filesort 1 PRIMARY ALL NULL NULL NULL NULL 681 Using where 1 PRIMARY IA ALL accepted NULL NULL NULL 11967 Using where 2 DERIVED xv_article fulltext topic topic 0 1 Using where; Using temporary; Using filesort This is example server with my data: user: bordeux_4prog password: 4prog phpmyadmin: http://phpmyadmin.bordeux.net/ chive: http://chive.bordeux.net/

    Read the article

  • PHP preg_match image between html tags

    - by Alvins
    I've got an html template like this: <div class="cont"> <div class="..."> <p>...<p> <img alt="" class="popup" src="DESIRED IMAGE LINK" style="..." /></p><p>...</p> .... And i want to extract "DESIRED IMAGE LINK" inside the "" tag, currently i'm using this: $pattern = '<div class="cont">.*?src=["\']?([^"\']?.*?(png|jpg|jpeg|gif))["\']?/i'; if (preg_match($pattern, $content, $image)) ..... But it doesn't work, the error is: warning: preg_match() [function.preg-match]: Unknown modifier '.' How can i fix it? Thanks

    Read the article

  • Deleting entire lines in a text file based on a partial string match with Windows PowerShell

    - by Charles
    So I have several large text files I need to sort through, and remove all occurrences of lines which contain a given keyword. So basically, if I have these lines: This is not a test This is a test Maybe a test Definitely not a test And I run the script with 'not', I need to entirely delete lines 1 and 4. I've been trying with: PS C:\Users\Admin (Get-Content "D:\Logs\co2.txt") | Foreach-Object {$_ -replace "3*Program*", ""} | Set-Content "D:\Logs\co2.txt" but it only replaces the 'Program' and not the entire line.

    Read the article

  • Reverse DNS does not match SMTP Banner

    - by Bastien974
    Hi all, I had this Warning with mxtoolbox. I know that it's not necessarily a big problem, but since we are having lots of issue with email delivery, I want to check everything. I have a Exchange server 07 + Sonicwall. My FQDN is office.mydomain.ca for send/receive connectors. When I try : telnet office.mydomain.ca 25 -- 220 MYSERVER.mydomain.local Microsoft ESMTP MAIL Service ready at Fri, 7 May 2010 10:34:36 -0400 I can change my SMTP Banner in the Sonicwall, but I don't know what to write, if there is a specific syntax or what can be the consequence if it doesn't work. Thanks for your help.

    Read the article

  • (Apache) RedirectMatch regex to match all directories except those in my list

    - by dotben
    I need to 301 redirect all requests coming in for requests to http//server.com to be redirected to http//newserver.com unless the request is for an arbitary list of directories we are maintaining on the legacy server (eg server.com/foo or server.com/bar) I'm having a hard time working out how best to set this up and the regexs. EG, I need: http//server.com/page1 redirect to http//newserver.com/page1 http//server.com/dir1/page2 redirect to http//newserver.com/dir1/page2 http//server.com/foo to load as normal http//server.com/bar/baz.html to load as normal ... because 'foo' and 'bar' are in my list of legacy dirs. I'm wondering if the way to do this is to some how catch the matches in my list and then redirect anything else as a wildcard over to the new server -- but I can't make it work. Can anyone help me with some regex and rewrites for those please? Thanks (apologies for fudging the http:// in the urls, ServerFault thinks I'm posting hyperlinks and won't otherwise let me post this)

    Read the article

  • Circle values that don't match any of the ones in a dropdown list

    - by Robert4242
    I created a dropdown list with values and assigned them to one of the columns in a table. When I changed a few, then changed the name of items in the list and removed some I accidentally did some key combination somewhere around Ctrl+Z or Ctrl+Y and Excel highlighted cells in the table that had a value not on the list. The highlighting looks like a red oval around each such cell. How can I toggle it on and off?

    Read the article

  • PostgreSQL timezone does not match system timezone

    - by Martin C.
    I have several PostgreSQL 9.2 installations where the timezone used by PostgreSQL is GMT, despite the entire system being "Europe/Vienna". I double-checked that postgresql.conf does not contain timezone setting, so according to the documentation it should fallback to the system's timezone. However, # su -s /bin/bash postgres -c "psql mydb" mydb=# show timezone; TimeZone ---------- GMT (1 row) mydb=# select now(); now ------------------------------- 2013-11-12 08:14:21.697622+00 (1 row) Any hints, where the GMT timezone could come from? The system user does not have TZ set and the /etc/timezone and /etc/timeinfo seem to be configured correctly. # cat /etc/timezone Europe/Vienna # date Tue Nov 12 09:15:42 CET 2013 Any hints are appreciated, thanks in advance!

    Read the article

  • Spoofing MAC address to match other device

    - by boj
    At my school, there is a WiFi network where you can register up to one computer or phone. I, however, wish to connect my phone and my computer (Windows 7). I talked to an IT guy at my school and he told me that it registers the computer based on the MAC address (For the record, he's the one who suggested I spoof). So, I got my phone's MAC and now I want to change my computer's address to the same thing. I found this link and this video, so I know how to change it. I was wondering if that would run into problems because they are normally on the same network at home.

    Read the article

< Previous Page | 9 10 11 12 13 14 15 16 17 18 19 20  | Next Page >