我想只匹配文件所在的文件夹名称,
如:
PIC/2009年 /cat01.jpg
PIC/2009/ 01 /cat02.jpg
我想把我用粗体添加的内容匹配.
到目前为止我有这个:
[^/]*/
Run Code Online (Sandbox Code Playgroud)
哪个会匹配,
pic/2009 / cat01.jpg
任何的想法?
我如何匹配此字符串中的URL地址,我有其他代码匹配文本,它似乎工作,但当我尝试在这里使用它,它没有,它一直说有"没有这样的文件或目录.我不知道grep -o只对文件有用吗?
matchString='url={"urlPath":"http://www.google.com/","thisIsOtherText"'
array=($(grep -o 'url={"urlPath":"([^"]+)"' "$matchString"))
grep: url={"urlPath":"http://www.google.com/","thisIsOtherStuff": No such file or directory
Run Code Online (Sandbox Code Playgroud)
无论如何,你能不能帮助我匹配"matchString"变量中的URL(它不必使用grep).
首选输出:http://www.google.com/
我不能为我的生活看到为什么我不能读取while循环之外的postPrioity.我试过"export postPrioity ="500""仍然无法正常工作.
有任何想法吗?
- 或在计划文本中 -
#!/bin/bash
cat "/files.txt" | while read namesInFile; do
postPrioity="500"
#This one shows the "$postPrioity" varible, as '500'
echo "weeeeeeeeee ---> $postPrioity <--- 1"
done
#This one comes up with "" as the $postPrioity varible. GRRR
echo "weeeeeeeeee ---> $postPrioity <--- 2"
Run Code Online (Sandbox Code Playgroud)
OUTPUT :(我在files.txt中只有3个文件名)
weeeeeeeeee ---> 500 <--- 1
weeeeeeeeee ---> 500 <--- 1
weeeeeeeeee ---> 500 <--- 1
weeeeeeeeee ---> <--- 2
Run Code Online (Sandbox Code Playgroud) 这就是我现在所拥有的.
<h2>Information</h2>\n +<p>(.*)<br />|</p>
^ that is a tab space, didn't know if there was
a better way to represent one or more (it seems to work)
Run Code Online (Sandbox Code Playgroud)
我试图匹配'bla bla'.文本,但我当前的正则表达式不太有效,它将匹配大部分行,但我希望它匹配第一行
<h2>Information</h2>
<p>bla bla.<br /><br /><a href="http://www.google.com">google</a><br />
Run Code Online (Sandbox Code Playgroud)
要么
<h2>Information</h2>
<p>bla bla.</p> other code...
Run Code Online (Sandbox Code Playgroud)
哦,我的PHP代码:
preg_match('#h2>Information</h2>\n +<p>(.*)<br />|</p>#', $result, $postMessage);
Run Code Online (Sandbox Code Playgroud) 我正在使用Moodle: 
我试图从框架内运行一些Javascript以获得浏览器窗口高度,因此我可以提醒用户他们是否使用不那么理想的浏览器大小.
我尝试过这样的事情:
window.top.document.body.offsetHeight
document.documentElement.clientHeight
$(document).height()
$(window).height()
Run Code Online (Sandbox Code Playgroud)
但是当我调整浏览器大小时,它们都会给出静态高度,这些高度永远不会改变
哦,它必须在IE8中工作.
我找到了命令"mdls",它将显示元数据,但我看不到如何删除它.
我想从我的文件中删除评论"kMDItemFinderComment","kMDItemWhereFroms".
有没有办法做到这一点?
每次有人点击导航按钮时,我都试图让jquery移动到页面顶部.
当某些人点击一个按钮时,它会隐藏旧内容并显示新内容,但它不会重置浏览器滚动位置,因此最终用户会感到有些困惑.
所以我想添加一些window.location.hashJS命令来解决这个问题,但这只在第一次执行时才有效.
我的代码:
$(document).ready(function(){
$("#prac-btn").click(function() {
$('#myTab a[href="#prac-page"]').tab('show');
window.location.hash = "#top";
});
$("#act-btn").click(function() {
$('#myTab a[href="#act-page"]').tab('show');
window.location.hash = "#top";
});
$("#pro-btn").click(function() {
$('#myTab a[href="#pro-page"]').tab('show');
window.location.hash = "#top";
});
});