How can I match the following pattern?
"anything123.anythingelse"
Alphanum of any length, with exactly 1 "." in the middle, and then alphanum of any length?
Thanks.
I'm desperately searching for regular expressions that match these scenarios:
1) Match alternating chars
I've a string like "This is my foobababababaf string" - and I want to match "babababa"
Only thing I know is the length of the fragment to search - I don't know what chars/digits that might be - but they are alternating.
I've really no clue where to start :(
2) Match combined groups
In a string like "This is my foobaafoobaaaooo string" - and I want to match "aaaooo". Like in 1) I don't know what chars/digits that might be. I only know that they will appear in two groups.
I experimented using (.)\1\1\1(.)\1\1\1 and things like this...
I am using ruby 1.8.7. I am not using rails.
How do I find all the links which are not already in anchor tag.
s = %Q{ <a href='www.a.com'><b>www.a.com</b></a> www.b.com <div>www.c.com</div> }
The output of above string should be
www.b.com
www.c.com
I know "b" tag before www.a.com complicates the case but that's what I have to work with.
<SPAN id=spanD121C150D2 style="BACKGROUND-COLOR: antiquewhite" CategoryID="1" MessageID="2316" refSpan="">
<SPAN id=span1CE69EDE12 style="BACKGROUND-COLOR: blue" CategoryID="2" MessageID="2316" refSpan="">platnosci inny srodkiem platnosci. DC - zakup paliwa na stacji benzynowej 101-500 (150 zl). 27
</SPAN>
</SPAN>
I have a string like above.
If the selected text is "srodkiem ", is it possible to get the relevant span tag?
Is this possible using a regular expression?
$('#customerAddress').text().replace(/\xA0/,"").replace(/\s+/," ");
Going after the value in a span (id=customerAddress) and I'd like to reduce all sections of whitespace to a single whitespace. The /\s+/ whould work except this app gets some character 160's between street address and state/zip
What is a better way to write this? this does not currently work.
I have a paragraph, in that, some of the texts are surrounded with a specific html tag. I need to to find the text which are not surrounded by that specific html tag.
For example
AVG Antivirus for Smartphones and Tablets detects harmful apps and SMS.
<font color='black'>AVG</font> Mobilation™ AntiVirus Pro for Android™ is a mobile security
solution that helps protect your mobile device from viruses, malware, spyware and online
exploitation in real-time. avg blah blah...
I want to find the word AVG (case insensitive) which is not surrounded by <font color='black'> </font>. It can be part the word or single whole word. In the case of part of the text, the whole word containing the word AVG should not surrounded by that html tag
How can I do it with Java?
I'm trying to extract the # of minutes from a text field using Oracle's REGEXP_SUBSTR() function.
Data:
Treatment of PC7, PT1 on left. 15 min.
15 minutes.
15 minutes
15 mins.
15 mins
15 min.
15 min
15min
15
In each case, I'm hoping to extract the '15' part of the string.
Attempts:
\d+ gets all of the numeric values, including the '7' and '1', which is undesirable.
(\d)+(?=\ ?min) get the '15' from all rows except the last.
(?((\d)+(?=\ ?min))((\d)+(?=\ ?min))|\d+), an if-else statement, doesnt' match anything.
What is wrong with my if-else statement?
I need to get all characters between '(' and ')' chars.
var str = "dfgdgdfg (aaa.bbb) sfd (c) fdsdfg ( ,ddd (eee) )";
In this example, I need to get 3 strings:
(aaa.bbb)
(c)
( ,ddd (eee) )
What pattern I have to write? Please, help.
I need to convert
$text = 'We had <i>fun</i>. Look at <a href="http://example.com">this photo</a> of Joe'
to
$text = 'We had fun. Take a look at this photo (http://example.com) of Joe'
All HTML tags are to be removed and the href value from <a> tags needs to be added like above.
What would be an efficient way to solve this? Any code snippet would be great.
I'm building a MySQL query but I can't seem to get it right.
I have four tables:
- customers
- orders
- sales_rates
- purchase_rates
There is a 1:n relation 'customernr' between customers and orders.
There is a 1:n relation 'ordernr' between orders and sales_rates.
There is a 1:n relation 'ordernr' between orders and purchase_rates.
What I would like to do is produce an output of all customers with their total purchase and sales amounts.
So far I have the following query.
SELECT c.customernr, c.customer_name, SUM(sr.sales_price) AS sales_price, SUM(pr.purchase_price) AS purchase_price
FROM orders o, customers c, sales_rates sr, purchase_rates pr
WHERE o.customernr = c.customernr
AND o.ordernr = sr.ordernr
AND o.ordernr = pr.ordernr
GROUP BY k.bedrijfsnaam
The result of the sales_price and purchase_price is far too high. I seem to be getting double counts. What am I doing wrong? Is it possible to perform this in a single query?
Thank for your response!
The message has detection report:
<detection_report>
Test 1
Test 2
Test 3
</detection_report>
---------------------------------------------
Have a nice day
I want to select portion between <detection_report> tags, including these two tags.
I have written following code.
The message has detection report\:((.|\n|\r)+)(\<\/detection_report\>)
but its not working. Can anyone help me with this.
<table >
<tr>
<td colspan="2" style="height: 14px">
tdtext1
<a>hyperlinktext1<a/>
</td>
</tr>
<tr>
<td>
tdtext2
</td>
<td>
<span>spantext1</span>
</td>
</tr>
</table>
This is my sample text how to write a regular expression in C# to get the matches for the innertext for td, span, hyperlinks.
Hi,
How can I take a line like this:
Digital Presentation (10:45), (11:30), 12:00, 12:40, 13:20, 14:00, 14:40, 15:20, 16:00, 16:40, 17:20, 18:00, 18:40, 19:20, 20:00, 20:40, 21:20, 22:00, 22:40, 23:10, 23:40.
And match all the 24 hour times so I can convert to a more human readable format using date()?
Also I want to match times in the 24:00-24:59 range too
Thanks!
Is there any way to tell sed to output only captured groups? for example given by input:
This is a sample 123 text and some 987 numbers
and pattern
/([\d]+)/
I could get only 123 and 987 output in the way formatted by back references perhaps?
In Perl I would do something like this for taking different fields in a regexp, separating different fields by () and getting them using $
foreach $line (@lines)
{
$line =~ m/(.*?):([^-]*)-(.*)/;
$field_1 = $1
$field_2 = $2
$field_3 = $3
}
How could I do something like this in Python?
Hello community,
I am strugling with what seems an easy problem to tackle (at least for me in MySQL / SqlServer!)
I'll simplify the problem. Let's say I have the following table:
Table VOTE
ID ID_IDEA DATE_VOTE with ID_IDEA FK(IDEA.ID)
1 3 10/10/10
2 0 09/09/10
3 3 08/08/10
4 3 11/11/10
5 0 06/06/10
6 1 05/05/10
I'm trying to find the latest votes given for each individual idea, meaning I want to return only rows with ID 4, 2 and 6.
It seems with Oracle that you can't use GROUP BY without using a function like SUM(), AVG, etc. I'm a bit confused about how it's supposed to work.
Please advise,
Thanks.
Let's say I want to look for
<Address>
<Street>Windsor</Street>
</Address>
and I do not want to return
<Address>
<Number>15</Number>
<Street>Windsor</Street>
</Address>
i.e. I am looking for addresses where the Address node does not contain a number tag.
I tried things like <Address>(?!Number)</Address> or <Address>.*?(?!Number).*?</Address> but can't quite figure it out :-(
Any ideas?
TIA
eddiec :-)
Supposed I have the following string:
string str = "<tag>text</tag>";
And I would like to change 'tag' to 'newTag' so the result would be:
"<newTag>text</newTag>"
What is the best way to do it?
I tried to search for <[/]*tag but then I don't know how to keep the optional [/] in my result...
I'm trying to use Notepadd++ to find all occurrences of width=xxx so I can change them to width="xxx"
as far as I have got is width=[^\n] which only selects width=x
I want to transform a line that looks like this:
any text #any text# ===#text#text#text#===#
into:
any text #any text# ===#texttexttext===#
As you can see above I want to remove the # between ===# and ===#
The number of # that are supposed to be removed can be any number.
Can I do this with sed?
Oracle Utilities Application Framework V4.1 Group Fix 4 is available from My Oracle Support as Patch 13523301. This Group Fix contains a number of enhancements and keeps fixes up to date to the latest patch level.
The enhancements included in this Group Fix include:
UI Hints - In previous group fixes of the Oracle Utilities Application Framework the infrastructure to support UI Hints was introduced. This group fix completes the release of this functionality. Prior to this enhancement, products and implementers typically would build at least one UI Map per Business Object to display and/or maintain the object. Whilst, this can be generated using the UI Map maintenance function and stored, this enhancement allows additional tags and elements to be added to the Business Object directly to allow dynamic generation of the UI Map for maintenance and viewing the object. This reduces the need to generate and build a UI Map at all for that object. This will reduce maintenance effort of maintaining the product and implementation by eliminating the need to maintain the HTML for the UI Map. This also allows lower skilled personnel to maintain the system. Help and working examples are available from the View schema attributes and node names option from the Schema Tips dashboard zone. For example:
Note: For examples of the hints, refer to an of the following Business Objects F1_OutcomeStyleLookup, F1-TodoSumEmailType, F1-BOStatusReason or F1-BIGeneralMasterConfig.
Setting batch log file names - By default the batch infrastructure supplied with the Oracle Utilities Application Framework sets the name and location of the log files to set values. In Group Fix 4 a set of user exits have been added to allow implementers and partners to set their own filename and location.
Refer to the Release Notes in the download for more details.
I am hoping to get some advice in setting up disk quotas. So, I know about:
Adding usrquota and grpquota on to /etc/fstab for the file systems that need to be managed.
Using edquota to assign disk quotas to users.
However, I need to do the last step for multiple users and edquota seems to be a bit troublesome.
One solution that I have found is that I can do: sudo edquota -u foo -p bar. This will copy the disk quota of bar to user foo. I was wondering if this is the best solution?
I tried setting up group disk quotas but they don't seem to be working. Are group quotas meant to help in the assignment of the same quota to multiple users? Or are they suppose to give a total limit to a set of users? For example, if users A, B, C are in group X then assigning a quota of 20 GB gives each user 20 GB or does it give 20 GB to the entire group X to divide up? I'm interested in doing the former, but not the latter.
Right now, I've assigned group disk quotas and they aren't working. So, I guess it is due to my misunderstanding of group disk quotas...
My problem is I want to easily give the same quota to multiple users; any suggestions on the best way to do this out of what I've tried above or anything else I may not have thought of?
Thank you!
Given a data set like this;
+-----+---------------------+--------+
| id | date | result |
+-----+---------------------+--------+
| 121 | 2009-07-11 13:23:24 | -1 |
| 122 | 2009-07-11 13:23:24 | -1 |
| 123 | 2009-07-11 13:23:24 | -1 |
| 124 | 2009-07-11 13:23:24 | -1 |
| 125 | 2009-07-11 13:23:24 | -1 |
| 126 | 2009-07-11 13:23:24 | -1 |
| 127 | 2009-07-11 13:23:24 | -1 |
| 128 | 2009-07-11 13:23:24 | -1 |
| 129 | 2009-07-11 13:23:24 | -1 |
| 130 | 2009-07-11 13:23:24 | -1 |
| 131 | 2009-07-11 13:23:24 | -1 |
| 132 | 2009-07-11 13:23:24 | -1 |
| 133 | 2009-07-11 13:23:24 | -1 |
| 134 | 2009-07-11 13:23:24 | -1 |
| 135 | 2009-07-11 13:23:24 | -1 |
| 136 | 2009-07-11 13:23:24 | -1 |
| 137 | 2009-07-11 13:23:24 | -1 |
| 138 | 2009-07-11 13:23:24 | 1 |
| 139 | 2009-07-11 13:23:24 | 0 |
| 140 | 2009-07-11 13:23:24 | -1 |
+-----+---------------------+--------+
How would I go about grouping the results by day 5 records at a time. The above results is part of the live data, there is over 100,000 results rows in the table and its growing. Basically I want to measure the change over time, so want to take a SUM of the result every X records. In the real data I'll be doing it ever 100 or 1000 but for the data above perhaps every 5.
If i could sort it by date I would do something like this;
SELECT
DATE_FORMAT(date, '%h%i') ym,
COUNT(result) 'Total Games',
SUM(result) as 'Score'
FROM nn_log
GROUP BY ym;
I can't figure out a way of doing something similar with numbers. The order is sorted by the date but I hope to split the data up every x results. It's safe to assume there are no blank rows.
Doing it above with the data you could do multiple selects like;
SELECT SUM(result) FROM table LIMIT 0,5;
SELECT SUM(result) FROM table LIMIT 5,5;
SELECT SUM(result) FROM table LIMIT 10,5;
Thats obviously not a very good way to scale up to a bigger problem. I could just write a loop but I'd like to reduce the number of queries.
I am trying to create an update query and making little progress in getting the right syntax.
The following query is working:
SELECT t.Index1, t.Index2, COUNT( m.EventType )
FROM Table t
LEFT JOIN MEvents m ON
(m.Index1 = t.Index1 AND
m.Index2 = t.Index2 AND
(m.EventType = 'A' OR m.EventType = 'B')
)
WHERE (t.SpecialEventCount IS NULL)
GROUP BY t.Index1, t.Index2
It creates a list of triplets Index1,Index2,EventCounts.
It only does this for case where t.SpecialEventCount is NULL. The update query I am trying to write should set this SpecialEventCount to that count, i.e. COUNT(m.EventType) in the query above. This number could be 0 or any positive number (hence the left join). Index1 and Index2 together are unique in Table t and they are used to identify events in MEvent.
How do I have to modify the select query to become an update query? I.e. something like
UPDATE Table SET SpecialEventCount=COUNT(m.EventType).....
but I am confused what to put where and have failed with numerous different guesses.