我大约有1000行数据,C列中的每个单元格都填充了博客文章的html。我需要提取任何以“ https://”开头并以“ .jpg”结尾的URL(文本字符串)
每个单元格中每个URL多次出现,并且某些单元格中也包含其他URL(没有超链接,都是纯文本)
我尝试了很多FIND,IF,MID等...,但仅在一次出现时有效。
有人可以帮助宏吗?谢谢!
答案 0 :(得分:1)
在D1(或适合您的任何其他列)中输入以下公式:
<?php //Linking the configuration file
require '../config.php';
session_start();
if(isset($_POST["btnSubmit"])){
$firstname = $_POST["fname"];
$lastname = $_POST["lname"];
$email = $_POST["email"];
$address = $_POST["address"];
$state = $_POST["state"];
$zip = $_POST["zip"];
$username = $_POST["username"];
$password = md5($_POST['password']);
$sql= "INSERT INTO signup
(user_id, fname, lname, email , address ,
country , postal_code , username, password )
VALUES (NULL,' firstname', '$lastname', '$email', '$address',
'$state', '$zip', '$username','$password')";
if(mysqli_query($conn,$sql)){
//echo "Inserted successfully";
header('http://localhost:8080/project/FINAL%20PAGE/register/myaccount.php');
} else{
echo "Error:". $conn->error;
}
}
?>
<!DOCTYPE HTML><html>
<head>
<title> SIGN UP </title>
<style>
h2{ background-color: transparent;
text-align:center; border-radius: 10px 10px 0 0;
margin: -10px -40px; padding: 30px;
}
hr{
border:0;
border-bottom:1px solid #ccc;
margin: 10px -40px;
margin-bottom: 30px;
}
#form_layout{
width:600px;
float: left;
border-radius: 10px;
font-family:raleway;
border: 2px solid #ccc;
padding: 10px 40px 25px;
margin-top: -2px;
}
input[type=text],input[type=password],#state{
width:99.5%;
padding: 10px;
margin-top: 8px;
border: 1px solid #ccc;
padding-left: 5px;
font-size: 16px;
font-family:raleway;
}
input[type=submit],input[type=reset]{
width: 100%;
background-color: #271960;
color: white;
border-radius: 8px;
padding: 10px;
font-size:20px;
</style>
<script src="signjs.js"></script>
<link rel="stylesheet" type="text/css" href="style.css">
<link rel="stylesheet" type="text/css" href="signupjs.css">
<link rel="stylesheet" href="reg.css">
</head>
<body>
<fieldset >
<article>
<img src = "logo.png" style = "width = 200px ; height : 200px ;border-radius: 50%;">
<div class = "right"><a href = "www.google.com">
<br><br><br>
<a href="../register/register.html"><img src = "profile1.png" alt = "profile" alt="Avatar"style = "float : right ; width : 30px ; height : 30px ;" " ></a>
</a>
<a href = "www.google.com">
<img src = "cart.png" alt = "cart" alt="Avatar"style = "float : right ; width : 30px ; height : 30px ;"></a><br /><br />
<a href="../register/register.html"><button type = "button" style="font-size: 10px;padding: 10px 24px;" >SIGN UP </button></a>
<a href="../log in/login.html"><button type = "button" style="font-size: 10px;padding: 10px 24px;">LOGIN </button></p></a>
<form class="example" action="/action_page.php">
<input type="text" placeholder="Search.." name="search2">
<button type="submit" style="font-size: 10px;padding: 10px 24px;">Search<i class = "fa fa-search""></i></button>
</form>
<br />
</div>
<br />
<div class="topnav-centered" >
<ul style = "float : left;" width="100%">
<li><a href="C:\Users\Abiiiiiiii\Desktop\FINAL PAGE\home\home.html">Home</a></li>
<li><a href="C:\Users\Abiiiiiiii\Desktop\FINAL PAGE\services\services.html">Services</a></li>
<li><a href="C:\Users\Abiiiiiiii\Desktop\FINAL PAGE\about us1.html">About Us</a></li>
<li><a href="C:\Users\Abiiiiiiii\Desktop\FINAL PAGE\help.html">Help</a></li>
<li><a href="C:\Users\Abiiiiiiii\Desktop\FINAL PAGE\about us.html">Contact us</a></li>
</ul>
</div>
</header>
</fieldset>
<body>
</span>
<div class="container">
<div class="main">
<h2>Create Account</h2>
<span id="error">
</span>
<form method="post" onsubmit='return formValidation()' action="config.php"><br>
<p id="head"></p><br>
<h3>Personal Details</h3>
<label>First Name:</label>
<input type='text' id='firstname' name="fname"/><br />
<p id="p1"></p>
<label>Last Name:</label>
<input type='text' id='lastname' name="lname"/><br /> <p></p>
<label>Email:</label>
<input type='email' id='email' name="email"/><br />
<h3>Shipping Details</h3>
<label>Address:</label>
<input type='text' id='addr' name="address" placeholder="23,Galle Rd, Colombo 02" /><br />
<p id="p5"></p>
<label>Postal Code: </label>
<input type='text' id='zip' name="zip" /><br />
<p id="p6"></p>
<label>Country:</label>
<select id='state' name="state">
<option>Please Choose</option>
<option>Sri Lanka</option>
<option>India</option>
<option>Malaysia</option>
<option>Thailand</option>
</select><br />
<h3>Account details</h3>
<label>Username(6-8 characters):</label>
<input type='text' id='username' name="username"/><br />
<p id="p2"></p>
<label>Password:</label>
<input type='password' id='passwrd' name='password' /><br />
<p id = "p12"></p>
<input type='submit' id="submit" value='Sign Up' name="btnSubmit"/><br />
<input type='reset' id="reset" value='Reset'/><br />
</form>
</div>
</div>
</style>
<div class="ft">
<table border="0" width="100%" height="100" style="background-color:#271960;font-family:sans-serif;font-size:15px;">
<tr><td height="100" style="color:white;padding:10px;"> No 354,<br> Green road,<br> Colombo 07.<br> Tel:+94771222777<br>
haffycards@gmail.com</br>© haffy cards. All Rights Reserved.</td><td align="center" style="color:white;"><i>Like us | Follow us on </i></td>
<div class="im"><td><a href ="https://www.facebook.com"><img src="../a1.png" width="50" style="border-radius:20px;"></a></td>
<td><a href ="https://www.instagram.com"><img src="../a3.png" width="50" style="border-radius:20px;"></a></td></div>
<td><a href ="https://twitter.com/?lang=en"><img src="../a4.png" width="50"style="border-radius:20px;"></a></td>
<td><a href ="https://www.pinterest.com"><img src="../a5.png" width="50" style="border-radius:20px;"></a></td></tr></table>
</div>
</body>
</html>
<?php
mysqli_close($conn); ?>
然后抄下来。
答案 1 :(得分:0)
我最终只是通过简单的查找和替换操作来完成此操作。起初我以为每个URL都太不同了,但是唯一的区别是每个URL末尾有2个文件夹(路径),例如:2017/01 / filename.jpg。因此,在此之前,我只是在根url上进行了查找和替换,然后转到新的url路径,然后在每个月的文件夹中进行了查找和替换,以将其删除。它只能追溯到2010年左右。
出于记录目的,只是为了不必要地为自己辩护,最初的问题是:“每个单元格中都有多个重复出现的原因,这就是为什么我可以确定我需要一个宏,但很显然,通常,这是一种更简单的方法!